|
-
Feb 14th, 2016, 04:02 PM
#1
Thread Starter
New Member
Download mysql data and loop
Hi, I create very simple mysql message system, when you enter specific tab page it opens mysql connection, downloads data to DataGridView, and that works great, what I am trying to do now, is when user clicks on that tab, program will request mysql data every 5 seconds or so, something like: Do, Loop I just don't know which place to put it.
Code:
Private Sub TabPage_chat_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabPage_chat.Enter
Dim SDA As New MySqlDataAdapter
Dim dbDataSet As New DataTable
Dim bSource As New BindingSource
Dim Command As New MySqlCommand
Try
con.Open()
Dim Query As String
Query = "select * from messages ORDER BY time DESC"
Command = New MySqlCommand(Query, con)
SDA.SelectCommand = Command
SDA.Fill(dbDataSet)
bSource.DataSource = dbDataSet
DataGridView_czat.DataSource = bSource
SDA.Update(dbDataSet)
con.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
con.Dispose()
End Try
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|