-
Another SQL query error
I get an error message asking for a semi-colon at the end of statment, but it's there. What is wrong.
This is an access database being accesses in vb.net
using this query:
Dim sqlquery2 As String = "INSERT INTO productFile( productID, Name, CostPrice, SalePrice, Type, ProductDisc, SupplierID, ServingsPerUnit) VALUES ( " & prodno & ", '" & prodName & "', " & costPrice & ", " & salePrice & ", '" & type & "', '" & prodDesc & "', " & supplier & ", " & prodServ & " ) WHERE productID = " & prodno & ";"
:confused:
-
Try to send your query string to a MsgBox to see what the actual query looks like.
-
1 Attachment(s)
Look at the JPG it looks fine to me
-
Yeah, it does look fine. Try double quotes around the strings... that might work...
-
I have double qutes arrount stings in the VALUES part, bo you mean also in the SELECT part??
-
I mean... instead of a single quote and a double quote, try two double quotes. I think that your problem may be that the single quotes aren't allowing Access to finish the string which may be why it's asking for the semi-colon.
So, your results should look like:
INSERT INTO Table1 (column1) VALUES ("value1")
rather than
INSERT INTO Table1 (column1) VALUES ('value1')
I seem to remember running into this same problem myself.
-
Hang on just fiqured it.
You cannot have a WHERE in an insert stament,
why I put it there in the first place beats me???
to many hour in front of my puter probably
:p
-
good point... you can't add a record and put conditions on it at the same time... :-)