|
-
Dec 12th, 2005, 02:22 PM
#5
Re: Can ADD and DELETE from mDB but not UPDATE..?!?!
 Originally Posted by kaihirst
Hi,
right then, were getting somewhere now..
VB Code:
'ELSEIF Request.Form("flag")="2" THEN
' SQLstmt = "UPDATE Prices SET "
' SQLstmt = SQLstmt & "Varenavn='" & TRIM(Request.Form("Varenavn")) & "', "
' SQLstmt = SQLstmt & "Varenummer='" & TRIM(Request.Form("Varenummer")) & "', "
' SQLstmt = SQLstmt & "Varepris='" & TRIM(Request.Form("Varepris")) & "',"
' SQLstmt = SQLstmt & " WHERE_ID='" & TRIM(Request.Form("Recordid")) &"'"
As you can see, ive made some changes to your statement.
1. the WHERE_ID never use spaces in your tables at all. So change this for what ive substituted adn youre away.
2. Plus you missed some single quotes out and I have added them...
try this and see how you get on.
Kai
Slow down there trigger....
The WHERE ID wasn't a FIELD name.... it was his WHERE clause. WHERE ID = 12.
Assuming ID is in fact a number, the lack of quotes on it is correct.
OKay... but we are getting somewhere.... Even though you've specified the table to be updated in the UPDATE clause, because you are using a WHERE clause, you have to specify the FROM caluse as well.... as silly as it seems, it should be done.
-- strike that... I see the problem....
VB Code:
ELSEIF Request.Form("flag")="2" THEN
SQLstmt = "UPDATE Produkter SET "
SQLstmt = SQLstmt & "Varenavn='" & TRIM(Request.Form("Varenavn")) & "', "
SQLstmt = SQLstmt & "Varenummer=" & TRIM(Request.Form("Varenummer")) & ", "
SQLstmt = SQLstmt & "Varepris=" & TRIM(Request.Form("Varepris")) & ", "
SQLstmt = SQLstmt & "Varetekst='" & TRIM(Request.Form("Varetekst")) & "', " <-- see this comma right here? It shouldn't be there. Dump it.
SQLstmt = SQLstmt & " WHERE ID=" & TRIM(Request.Form("Recordid"))
I didn't see that until I was pasting your code it... then it stood out.... The last coma after the last field being updated is not needed as there are no more fields listed after it.
-tg
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
|