下面的代码:VB SQL UPDATE命令返回错误“运行时错误424:需要对象。”
Dim tr As Transactions
Set tr = New Transactions
Dim ID As Integer
Dim name As String, username As String, password As String, activate As String
name = cmbName.Value
ID = tr.GetUserID(name)
If (AccountActivated = True) Then
username = txtUsername.Value
password = txtPassword.Value
MsgBox name & " " & username & " " & password
activate = "Yes"
Else
username = ""
password = ""
activate = "No"
End If
tr.UpdateAccount name, username, password, activate 'ERROR HERE: Object required
这里; S功能我打电话:
Public Function UpdateAccount(ByVal name As String, ByVal username As String, ByVal password As String, ByVal activation As String)
Call connectDB
sSQL = "update User set Username = '" & username & "', Password = '" & password & "', AccountActivated = '" & activation & "' where Name = '" & name & "'"
MsgBox sSQL
db.Execute sSQL
End Function
接收到确切的错误信息是什么?而且,你一定要使用'Parameters'来绑定'username','password','activation'和'user'的值。 – 2011-04-26 03:39:03
运行时错误424:所需的对象 – Ali 2011-04-26 04:51:38
这是什么语法,所以我可以尝试?谢谢! – Ali 2011-04-26 04:52:06