开发者

Problems refreshing DataGridView after database update in VB.NET

开发者 https://www.devze.com 2023-01-02 23:08 出处:网络
Dim myQuery = \"UPDATE table1 SET data= CONCAT (data,\'\" & 开发者_StackOverflow中文版vbCrLf & \"[ \" &Date.Now() & \" ]\" & \" \" & \"[\" & getCN() & \"]\" & \" \
 Dim myQuery = "UPDATE table1 SET data= CONCAT (data,'" & 开发者_StackOverflow中文版vbCrLf & "[ " &       Date.Now() & " ]" & " " & "[" & getCN() & "]" & " " & txtTelenotes.Text & "[ item1 ]" & "') WHERE id='" & txtID.Text & "'"
 myCommand.Connection = conn
 myCommand.CommandText = myQuery

 myAdapter.SelectCommand = myCommand
 Dim myData As MySqlDataReader
 myData = myCommand.ExecuteReader()

 txtTelenotes.Text = ""
 dgvREcord.Refresh()

I tried refreshing the DataGridView using:

  dgvREcord.Refresh()

but it does not load the changes from the database.


Close your data connection and re-open it.

I have a similar app but use tableadapters instead so mine looks like:

    Me.VictimsTableAdapter.Dispose()
    Me.VictimsTableAdapter.Fill(Me.VicsDataSet.Victims)
0

精彩评论

暂无评论...
验证码 换一张
取 消