DataGrid绑定Adodc后数据无法及时刷新
各位大哥,我VB6编程时往access的一个表插入数据后,adodc引用了此表,同时datagrid绑定了此adodc,但表中的数据始终与datagrid显示的数据相差一条,请问怎样设定可以及时刷新显示啊
access表中的数据
datagrid中的数据
Public Conn As New ADODB.Connection
Public Rs As New ADODB.Recordset
Public Sub OpenConn()
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\AlarmInf.mdb;Persist Security Info=False"
Conn.CursorLocation = adUseClient
Conn.Open
End Sub
Public Sub CloseConn()
Conn.Close
Set Conn = Nothing
End Sub
Private Sub Command1_Click()
Call OpenConn
Conn.Execute "insert into activealarm([SID],[Note]) select ID,Note from alarmlist where address='M5005'"
Adodc2.Refresh
Set DataGrid2.DataSource = Adodc2
'Adodc2.Refresh
DataGrid2.Refresh
Call CloseConn
End Sub