-
Oledb insert prob
I'm using the query builder inside visual studio to insert some data into database, the problem is that it keeps giving me an error saying: Error in values list in INSERT INTO clause. Unable to parse query text.
Here's the 'exact' SQL command that I am using, could someone please tell me where I am going wrong: INSERT INTO Accounts (customerID, balance, blocked, PIN) VALUES (@ customerID, @ balance, @ blocked, @ PIN)
Thanks for any help.
-
Re: Oledb insert prob
Your SQL is correct, but you have to set your parameters. I don't use query builder, so I am not sure if you can do that in the query builder.
In code it would look something like this, depending on your database, and what version of Visual Basic you are using.
Command.Parameters.add("@customerID", MyDataType).Value = MyValue
Hope that helps to get you at least half way there.
-
Re: Oledb insert prob
I managed to get rid of the error with the query builder by missing out the '@' (but I'm not sure if this is the correct way of doing it) form the SQL command but now I get an error saying: parameter customerID has no default value?
I have also set parameter collection to the right values.
Anyone have any suggestions?
-
Re: Oledb insert prob
You should not remove the "@" form your parameter names. What you need to do is get rid of the spaces. The "@" is part of the parameter name, so it should be:
Code:
INSERT INTO Accounts (customerID, balance, blocked, PIN) VALUES (@customerID, @balance, @blocked, @PIN)