Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't see the error

Status
Not open for further replies.

haneen97

Programmer
Dec 10, 2002
280
0
0
US
Hi,
I am getting an error on this line

SqlStr = "UPDATE Product SET Product_Name ='" & lName & "' WHERE Product_Id =" & lId & ";"
response.Write(SqlStr)
MyConn.Execute(SqlStr)

Message says "Expected ';'". I can't see the line missing the semi colon.

Thanks for your help.


Mo
 
I think you are missing quotes around your value.
If you were to write out you code without varables it would look like:
Code:
SqlStr = "UPDATE Product SET Product_Name ='Name' WHERE Product_Id =lId;
Put single quotes in your where clause like you did your Set clause. IE..
Code:
SqlStr = "UPDATE Product SET Product_Name ='" & lName & "' WHERE Product_Id ='" & lId & "';"

Then if you were to write it out without the variables again it would look like:
Code:
SqlStr = "UPDATE Product SET Product_Name ='Name' WHERE Product_Id ='lId';
 
I tried that. I got an error (Operation must use an updateable query) on the MyConn.Execute(SqlStr) line.

Any ideas?

Thanks

Mo
 
And what is Product ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Product is the table that I am updating.

Do you think it has to do with the way I connect to the data base? This is the connection set up.

Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/RxSoft.mdb") & ";"


Also, I tried this for the update and it is not working.

SqlStr = "UPDATE Product SET Product_Name ='" & lName & "' WHERE Product_Id =" & lId & ";"
RS.Open SqlStr, MyConn, 3


Mo
 
And this ?
MyConn.Execute SqlStr, , 1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Still get the same error (Operation must use an updateable query)

Mo
 
This is often a permission error.
I suppose, no lock file can be written to the db folder.

Set the folder permission to "write" for everybody and make sure these permissions are inherited to the subfolders and files.
The latter is important, since with every compact and repair, the permissions of the database are re-set to those of their parent folder.

Hope this helps.

Cheers,
Andy

[blue]An eye for an eye only ends up making the whole world blind. - "Mahatma" Mohandas K. Gandhi[/blue]
 
Every time I go to properities, I see the read only button checked on. I check it off and apply the changes but it does not save. I am still playing with it.

Mo
 
I am in, I am in. I think I have other problems but the page loads.

Thank you thank you.

Mo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top