VB 连接数据库Access来修改密码时,总是提示“rs.Open strSQL, conn, 3, 3”错误?怎么改正,请求大神!
Iffrmpassword.Text1.Text<>frmlogin.Text1.TextThenMsgBox"原始密码输入不正确,请重新输入!",vbInformati...
If frmpassword.Text1.Text <> frmlogin.Text1.Text ThenMsgBox "原始密码输入不正确,请重新输入!", vbInformation Or vbOKOnly, "系统提示"ElseIf frmpassword.Text2.Text <> frmpassword.Text3.Text ThenMsgBox "两次输入的新密码不一致,请重新输入!", vbInformation Or vbOKOnly, "系统提示"ElseDim conn As New ADODB.ConnectionDim rs As New ADODB.RecordsetDim Str1 As StringDim Str2 As StringDim Str3 As StringStr1 = "Provider=Microsoft.Jet.OLEDB.4.0;"Str2 = "Data Source=" & App.Path & "\password.mdb;"Str3 = "Jet OLEDB:Database Password="conn.Open Str1 & Str2 & Str3strSQL = "select * from password where P_W=" & Val(frmpassword.Text3.Text) & ""rs.Open strSQL, conn, 3, 3rs!P_W = frmpassword.Text3.Textrs.Updaters.Closeconn.CloseMsgBox ("修改记录成功!")Adodc1.Refreshfrmpassword.Hidefrmlogin.ShowEnd IfEnd If
展开
1个回答
展开全部
'改成
Dim a As Integer
a = Val(frmpassword.Text3.Text)
strSQL = "select * from password where P_W= " & a & ""
rs.Open strSQL, conn, 3, 3
更多追问追答
追答
郁闷,。。。没注意你的表名 password 是VB保留的关键字,所以你要加中括号才可以
这次没跑了
Dim a As Integer
a = Val(frmpassword.Text3.Text)
strSQL = "select * from [password] where P_W= " & a & ""
rs.Open strSQL, conn, 3, 3
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询