Pro VB DatabasesAdvanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
Hello,
Im writing an application which calls stored procedure in MSSQL 2008. This stored procedure inserts line into the table and returns the line number that is generated by SQL.
INSERT INTO ...
SELECT @@IDENTITY AS [PID]
If I run it from management studio, there is no problem, the line is added and right number of line is returned. But if run the same command from VB6 using a ADODB.Connection object, execution of the query fails with the error 'Incorrect syntax near 'GO''
Im using code that is generated by SQL management studio for the stored procedure and for calling it too.
For the line separation Im using the constant vbCrLf. At first look the queries are the same, what can be wrong?
If you are calling a SP, what are you using vbCrLf for???
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification : WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
In execution of SP there is two GO - generated by Management studio, GO must be on single line, or not? I will post the code after one hour, when I will arrive at home.
Why don't you call directly the SP is beyond my understand, but try with vbnewline instead of vbcrlf...
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification : WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
The Following User Says Thank You to gbianchi For This Useful Post:
Im not sure about that I understand you... I know that I not need to have all the breaks that I have, but Im mad from this problem and I want to have the same code that works in management studio...