datagrid的即时刷新

来源:互联网 发布:北欧生活 知乎 编辑:程序博客网 时间:2024/05/16 03:24
 Dim temprs As New ADODB.Recordset
  
   Dim tempsql As String
   On Error Resume Next
    tempsql = "Insert into Users(Name,Psw,pow) Values('" & txtName.Text & "','" & txtPsw.Text & "','" & cmbPow.Text & "')"
    temprs.Open tempsql, conn1, adOpenStatic, adLockOptimistic
    
    Adodc1.Recordset.AddNew
    Adodc1.Refresh
    DataGrid1.Refresh



   Dim temprs As New ADODB.Recordset
  
   Dim tempsql As String
   On Error Resume Next
    tempsql = "Delete from Users where ID = " & Text1.Text
  
    temprs.Open tempsql, conn1, adOpenStatic, adLockOptimistic
    
    With Adodc1
         .Recordset.Delete
         .Recordset.Update
         .Recordset.MovePrevious
    End With
    
    Adodc1.Refresh
    DataGrid1.Refresh
原创粉丝点击