大家帮忙看下我的VB代码,在DataGrid中修改的内容,在数据库中更新不了,谢谢了,在线等 20
PrivateSubCommand3_Click()DimrsAsNewADODB.RecordsetDimsqlAsStringDimanswerAsStringsql...
Private Sub Command3_Click()
Dim rs As New ADODB.Recordset
Dim sql As String
Dim answer As String
sql = "select * from 维护管理信息"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
answer = MsgBox("确定要更新吗?", vbYesNo, "")
If answer = vbYes Then
MsgBox "更新成功!", vbOKOnly + vbExclamation, ""
Set DataGrid1.DataSource = Nothing
rs.Update
rs.Requery
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
End If
End Sub 展开
Dim rs As New ADODB.Recordset
Dim sql As String
Dim answer As String
sql = "select * from 维护管理信息"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
answer = MsgBox("确定要更新吗?", vbYesNo, "")
If answer = vbYes Then
MsgBox "更新成功!", vbOKOnly + vbExclamation, ""
Set DataGrid1.DataSource = Nothing
rs.Update
rs.Requery
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
End If
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询