|
-
Apr 4th, 2007, 06:41 PM
#1
Thread Starter
New Member
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.
-
Apr 4th, 2007, 06:56 PM
#2
Hyperactive Member
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.
Ben
Using Visual Basic 2005/2008
-
Apr 4th, 2007, 07:15 PM
#3
Thread Starter
New Member
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?
-
Apr 4th, 2007, 07:55 PM
#4
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)
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
|