Click here to Skip to main content
15,919,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,
I have a following query:
1.I have a excel sheet which gives me live quotes of stock prices which changes second by second.
2.I want to import this data into sql server or any temporary storage as & when the price get change.
3.I want to generate alerts based on the change in the price.

So can anyone of you suggest me a way to do this?

Thanks & Regards.

Vinay D Sarmalkar
Posted
Comments
[no name] 21-Aug-12 14:31pm    
There are plenty of resources out there that show how to do all of this. Suggestions for what exactly? How to get Excel data into a database? What is "alert"? Javascript alert? An email? A message box? What does VB.NET have to do with anything? "sql server or any temporary storage "... well, which is it? Most of all, what have you tried?

1 solution

In this code firstly import your data into datagridview then it saves in sql database.try it
Where Test.Xlsx Is excel sheet and Excel is DataBase Table

Imports System.Data.SqlClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim DtSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter

Dim fBrowse As New OpenFileDialog
With fBrowse
.Filter = "Excel files(*.xlsx)|*.xlsx|All files (*.*)|*.*"
.FilterIndex = 1
.Title = "Import data from Excel file"
End With
If fBrowse.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim fname As String
fname = fBrowse.FileName
MyConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source='" & fname & " '; " & "Extended Properties=Excel 8.0;")
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection)
MyCommand.TableMappings.Add("Table", "Test")
DtSet = New System.Data.DataSet
MyCommand.Fill(DtSet)
DataGridView1.DataSource = DtSet.Tables(0)
MyConnection.Close()
For Each Drr As DataRow In DtSet.Tables(0).Rows
Execute_Local("INSERT INTO Excel(Name, Designation, Salary) VALUES ('" & Drr(0).ToString & "','" & Drr(1).ToString & "','" & Drr(2).ToString & "')")
Next
MsgBox("Successfully Saved")

End If

End Sub
End Class
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900