Subject: Question
Posted By: Ashwini Post Date: 1/5/2006 2:35:16 AM
Please help me in this querry
strdml="INSERT INTO order (Id,orderdate,type,comm,disc,consigneename,lcno,date,amount,expdate,buyerorderno,buyerorderdate,currency,remarks,commagent,style,model,deldate,unit)VALUES ('"&Id&"','"&orderdate&"','"&otype&"','"&comm&"','"&disc&"','"&consigneename&"','"&lcno&"','"&ldate&"','"&lamount&"','"&expdate&"','"&buyerorderno&"','"&buyerorderdate&"','"&bcurrency&"','"&remarks&"','"&commagent&"','"&style&"','"&model&"','"&deldate&"','"&unit&"')"

Errror is Syntax error in INSERT INTO statement.


Reply By: ChrisScott Reply Date: 1/5/2006 4:22:36 AM
Please post you question once only Ashwini - http://p2p.wrox.com/topic.asp?TOPIC_ID=38312

Reply By: rstelma Reply Date: 1/5/2006 12:31:42 PM
When inserting integer values only use double quotes. Single quotes are used for string values. I'm only guessing at this since you're trying to insert a value into the ID column which I'm hoping is an integer.

I don't know why you're inserting into an ID column when that value could be self-generating if you make this column an identity column, unless this is a foreign key. Its also probably not such a good idea to name a column ID in the first place. A much better approach would be to call that column OrderID to avoid any conflicts with reserved words.

Where you are inserting integers use:

" & ID & " and not '" & ID & "'

Hope this helps.

Richard




Go to topic 36512

Return to index page 402
Return to index page 401
Return to index page 400
Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393