Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing Stored Procedure Error

Status
Not open for further replies.

travisbrown

Technical User
Dec 31, 2001
1,016
Can anyone see the problem here? I get

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver]Syntax error or access violation

The error is on the execute line (last line). It is a insert procedure. The stored procedure seems fine; I can execute it in QA. I don't think there is a access violation, so is it syntax?


<%
vUserInfo = Split(Request.ServerVariables(&quot;AUTH_USER&quot;),&quot;\&quot;)
Select Case UBound(vUserInfo)
Case 0
vUser = vUserInfo(0)
Case 1
vUser = vUserInfo(1)
Case Else
vUser = &quot;anon&quot;

End Select

id = server.createobject(&quot;scriptlet.typelib&quot;).guid

dim db,sSQL,rs,GUID
guid = id

set db = Server.CreateObject (&quot;ADODB.Connection&quot;)
db.open = (&quot;DRIVER=SQL Server;SERVER=EDMSQLP1;DATABASE=BCHYDRO_CCM_FBT;UID=CCM_FBT_Admin;PWD=ccm_fbt_admin;&quot;)
sSQL = &quot;dbo.spSessionInsert&quot; & vUser & GUID
rs = db.execute(sSQL)
%>

Thanks.
 
I think it is syntax.
Try this....
Code:
sSQL =  &quot;dbo.spSessionInsert &quot; & &quot;'&quot; & vUser & &quot;', &quot; & UID 
rs = db.execute(sSQL)

You need singlge quotes aroung the string, and a comma separating the parameters.
 
Thanks, I think you are right; and I changed it to
sSQL = &quot;dbo.spSessionInsert '&quot; & vUser & &quot;', '&quot; & GUID & &quot;'&quot;

however, I get

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string '{61461256-D069-4DB1-83E9-77844CA75CD3}'.

(which is GUID)

I can't see where the open quote is.
 
Use a response.write and the a response.end to see what your variable string looks like.
 
dbo.spSessionInsert 'anon', '{F86C8769-94E6-4225-B78E-53D4A5F15CF3}

from this: sSQL = &quot;dbo.spSessionInsert '&quot; & vUser & &quot;', '&quot; & GUID & &quot;'&quot;

Why isn't it picking up the last quote?
 
OK, if i change the guid variable from the server generated server.createobject(&quot;scriptlet.typelib&quot;).guid to an absolute gvalue like test123, it works and includes the quotes. Any ideas why the guid would mess up the end quote?
 
You could solve this problem by making use of ADO Command and Parameter objects. codestorm
Fire bad. Tree pretty. - Buffy
Hey, I'm operating on a limited mental budget here.
<insert witticism here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top