October 5, 2010 at 8:43 am
myCommand = New SqlCommand("insert into invoices ('" & RouteNumber & "','" & Route_date & "','" & txtStop.Text & "','" & txtCust.Text & "','" & txtInv.Text & "','" & txtamt.Text & "','" & txtVerify1.Text & "','" & txtveramt1.Text & "','" & txtVerify2.Text & "','" & txtveramt2.Text & "','" & txtVerify3.Text & "','" & txtveramt3.Text & "','" & txtVerify4.Text & "','" & txtveramt4.Text & "','N','0','0','0','0','0','0'", conn2)
ra = myCommand.ExecuteNonQuery()
mycommand.commandtext = "insert into invoices (' 113','8/23/2010','15','938886 ','6547852','1111.11','totes','3','cartons','3','hba','12','freez','15','N','0','0','0','0','0','0'"
Anybody see the issue. i first started with no ticks around the 0's because didn't think number fields need ticks around them.
Any help would be most appreicated
October 5, 2010 at 8:51 am
Where's your closing parentheses that should be near the last '0'?
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
October 5, 2010 at 8:53 am
I have it after the last 0 then a , anc then conn2)
October 5, 2010 at 8:54 am
I have ending ) after the , conn2). Tried putting it after the last '0'"), conn2 but it through up error about missing paren
October 5, 2010 at 8:54 am
tmurray 69699 (10/5/2010)
I have it after the last 0 then a , anc then conn2)
:blink:
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.October 5, 2010 at 8:59 am
tmurray 69699 (10/5/2010)
I have ending ) after the , conn2). Tried putting it after the last '0'"), conn2 but it through up error about missing paren
It's not in the text you posted.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
October 5, 2010 at 9:02 am
if you look at the set up of mycommand in the first part of my post I have ending paren after conn2.
When I go into immediate window and print mycommand.commandtext it doesn't show the ending paren. If I put it after last '0'), conn2 I get a missing paren error.
October 5, 2010 at 9:06 am
tmurray 69699 (10/5/2010)
if you look at the set up of mycommand in the first part of my post I have ending paren after conn2.When I go into immediate window and print mycommand.commandtext it doesn't show the ending paren. If I put it after last '0'), conn2 I get a missing paren error.
have you tried '0')", conn2) ?
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
October 5, 2010 at 9:12 am
printing my command text looks good
"insert into invoices (' 113','8/23/2010','5','938886 ','9632587','75326.21','Totes','8','cartons','4','cigs','8','hba','3','N','0','0','0','0','0','0')"
but paste in sql manager and run query got me this
Msg 103, Level 15, State 4, Line 1
The identifier that starts with 'insert into invoices (' 113','8/23/2010','5','938886 ','9632587','75326.21','Totes','8','cartons','4','cigs','8','hba','3','N','' is too long. Maximum length is 128.
October 5, 2010 at 9:18 am
Shouldn't it be something like
INSERT INTO INVOICES
VALUES (xx,xx,xx,xx)
There is no Values or Select in your statement...I've never tried without it but I would imagine that would throw an error.
October 5, 2010 at 9:19 am
Here is actual code in vb.net
myCommand = New SqlCommand
("insert into invoices
('" & RouteNumber & "','" & Route_date & "','" & txtStop.Text & "','"
& txtCust.Text & "','" & txtInv.Text & "','" &
txtamt.Text & "','" & txtVerify1.Text & "','" & txtveramt1.Text & "'
,'" & txtVerify2.Text & "','" & txtveramt2.Text & "',
'" & txtVerify3.Text & "','" & txtveramt3.Text & "',
'" & txtVerify4.Text & "','" & txtveramt4.Text & "','N','0','0','0','0',
'0','0')", conn2)
ra = myCommand.ExecuteNonQuery()
October 5, 2010 at 9:22 am
Thanks... How I missed values is beyond me. Just goes to show that sometimes the second pair of eyes works when the obvious is missing
Thanks
October 5, 2010 at 9:25 am
Derrick Smith (10/5/2010)
Shouldn't it be something likeINSERT INTO INVOICES
VALUES (xx,xx,xx,xx)
There is no Values or Select in your statement...I've never tried without it but I would imagine that would throw an error.
Derrick, we don't need your help to look stupid. We can do that on our own!
Good catch and good example of how we sometimes overlook the simple stuff.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
Viewing 13 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy