I have a server machine(sql2008) and need to get data from 20 tables every sec.(table1,table2,ext..)
Used vs2015 and datagridview but local machines can't get data every sec. (crashed or lagged)
if i use 1 gridview it's work but i need to get data from 20 tables
how can i get 20 tables from sql on every sec.?
What I have tried:
timer interval=1000
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
getdata(DataGridView1,table1)
End Sub
Public Sub getdata(ByVal datagrid As Object, ByVal tableno As string)
Dim Server As String = "server"
Dim User As String = "sa"
Dim Pass As String = "1231231"
Dim Database As String = "database"
Dim ay = "; "
Dim DBConnection As String = ""
DBConnection = DBConnection & "Provider=SQLOLEDB.1" & ay
DBConnection = DBConnection & "Data Source=" & Server & ay
DBConnection = DBConnection & "Initial Catalog=" & Database & ay
DBConnection = DBConnection & "User ID=" & User & ay
DBConnection = DBConnection & "Password=" & Pass & ";"
Dim SQL As String
SQL = "select * from " & tableno & ""
Dim Conn As New ADODB.Connection()
Dim rs As New ADODB.Recordset()
Dim daTitles As New OleDbDataAdapter()
Dim dsTitles As New DataSet("test")
Conn.Open(DBConnection, "", "", -1)
rs.Open(SQL, DBConnection, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic)
daTitles.Fill(dsTitles, rs, "setting")
datagrid.DataSource = dsTitles.Tables(0)
rs.ActiveConnection.close()
rs.ActiveConnection = Nothing
Conn.Close()
Conn = Nothing
End Sub