datagridview不会在vb.net中自动更新

时间:2014-06-27 08:40:46

标签: vb.net datagridview

在插入记录后立即更新datagridview。

Private Sub updatedgv() Using congv As OleDbConnection = New OleDbConnection("Provider=microsoft.jet.oledb.4.0;data source=..\library.mdb") Dim strgv As String = "select * from NormalTransaction where RegNo='" & txt_RegisterNo.Text & "'" Dim cmdgv As OleDbCommand = New OleDbCommand(strgv, congv) Dim sdagv As OleDbDataAdapter = New OleDbDataAdapter(cmdgv) Dim dsgv As DataSet = New DataSet("gvSet") sdagv.Fill(dsgv) DataGridView1.DataSource = dsgv DataGridView1.DataMember = dsgv.Tables(0).TableName End Using End Sub

请帮我解决这个问题。

0 个答案:

没有答案