|
-
Oct 19th, 2008, 11:48 PM
#1
Thread Starter
Member
[RESOLVED] Update statement
Hai All.. can someone explain to me what is going on with my code? i think it's ok enough..
Code:
strSQL = "UPDATE tblUser SET User = '" & UCase(txtUser.Text) & "', fName = '" & UCase(txtfName.Text) & "', lName = '" & UCase(txtlName.Text) & "', Question = '" & UCase(comboQuestion.Text) & "', Secret = '" & UCase(txtSecret.Text) & "' WHERE User = '" & UserName & "'"
MsgBox strSQL
Set mobjCmd = New ADODB.Command
Set mobjCmd.ActiveConnection = conn
mobjCmd.CommandType = adCmdText
mobjCmd.CommandText = strSQL
mobjCmd.Execute
MsgBox "Update Successful", vbInformation, "Success"
This code is to update an existing record, the error return was:
Code:
Syntax error in update statement
 An Ordinary Person With An Extraordinary Determination 
-
Oct 20th, 2008, 12:40 AM
#2
Re: Update statement
Hmm can try wrapping "user" in [] so it becomes "[User]" i believe user is a reserved word so it will cause complications if you don't wrap it in brackets.
If a post has been helpful please rate it. 
If your question has been answered, pull down the tread tools and mark it as resolved.
-
Oct 20th, 2008, 04:47 AM
#3
Re: Update statement
Do you have any single quotes in there? Like last name = O'Brien. Even if you don't in the case I'd change that to:
Replace(UCase(txtlName.Text),"'","''")
-
Oct 20th, 2008, 07:04 PM
#4
Thread Starter
Member
Yes.. problem solve, thanks a lot. wrap it with bracket is all the solution.
 An Ordinary Person With An Extraordinary Determination 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|