Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Errors when called from ADO
Message
From
25/11/2016 12:55:14
 
 
To
25/11/2016 08:39:22
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01643938
Message ID:
01643955
Views:
30
>>>Good day all,
>>>
>>>Resently I have been getting a random error when I execute a T-SQL EXEC statement via ADO in a VBscript code.
>>>
>>>
>>>
>>>exec sel_comment 'Default','favorite--Default-',''
>>>
>>>
>>>error is
>>>
>>>[Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near '20'.
>>>
>>>The statement executes with an error when cur/paste in SSMS, but occurs when called from SQLconnection.execute in the code.
>>>
>>>I have not been able to find a solution on the web, Sometimes, the statement executes correctly, but most of the time it does not.
>>>
>>>Can someone suggest a idea to help me resolve the source of the error.
>>
>>Is your statement being encoded in some way / circumstances? "20" is hexa for space, so...
>
>I don't think so. All of the SQL statements are executed through Stored Procedures the same way. Only the one mention is failing.
>
>here is the VBscript code
>
>
>
>set conn = createobject("adodb.Connection")
>set rs = createobject("adodb.Recordset")
>conn.Open db_ConnStr
>
>cData	= "exec sel_comment '" & cPage & "','" & cBase & "',''"
>
>' exec sel_connect 'Default','favorite--Default-',''
>
>set rs = conn.execute( cData )
>
>
>Perhaps there is a better way to execute the SP.

UPDATE:
Ok, this is weird.

in debugging, I added a RESPONSE.WRITE cData

and the error persisted

I changed it to Response.Write Escape(cData)

the error went away. (scratching my head).

Commented out the Response statement, still no error.

Removed the Response statement and the error returned.

Placed it back as a comment, no error.

I can not determine the relationship, but for now, it fixes the problem.
Greg Reichert
Previous
Reply
Map
View

Click here to load this message in the networking platform