Getting syntax error when trying to execute a stored proc 
Author Message
 Getting syntax error when trying to execute a stored proc

I'm trying to execute a stored procedure in order to perform an insert
on a table. I'm executing the stored proc this way so that I can get
the returned value for the end user.
I'm getting "Syntax error or access violation" at oCmd.execute. I don't
get this error if I comment out the "command type" but then the stored
proc doesn't work.
I've been staring at this so long that I think I'm missing an obvious
problem that is causing this error. Any ideas?
<%
set conn=server.createobject("adodb.connection")
conn.open Application("APP_DB_CONNECTION_STRING"), _
Application "APP_USERNAME"), Application("APP_PASSWORD")
adddcoecnsql = "usp_adddco "&fabid&", "&tooltypeid&", _
"&faid&", "&processid&", '"&originatorname&"', _
'"&originatoremail&"', '"&quarter&"', '"&currmasterrev&"', _
'"&falreviewername&"'"
Set oCmd = CreateObject("ADODB.Command")
oCmd.ActiveConnection = conn
oCmd.CommandText = adddcoecnsql
oCmd.CommandType = adCmdStoredProc
Response.Write("<br>command text: "&oCmd.CommandText)
oCmd.Parameters.Append oCmd.CreateParameter("retval", _
adInteger, adParamReturnValue)
oCmd.Execute
Response.Write("<br>retval: "& ocmd(0))
%>

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 08 Sep 2002 03:00:00 GMT  
 Getting syntax error when trying to execute a stored proc
Have you included the "adovbs.inc" file that defines all of the adBlahBlah constants?

--
Michael Harris
MVP Scripting

I'm trying to execute a stored procedure in order to perform an insert
on a table. I'm executing the stored proc this way so that I can get
the returned value for the end user.
I'm getting "Syntax error or access violation" at oCmd.execute. I don't
get this error if I comment out the "command type" but then the stored
proc doesn't work.
I've been staring at this so long that I think I'm missing an obvious
problem that is causing this error. Any ideas?
<%
set conn=server.createobject("adodb.connection")
conn.open Application("APP_DB_CONNECTION_STRING"), _
Application "APP_USERNAME"), Application("APP_PASSWORD")
adddcoecnsql = "usp_adddco "&fabid&", "&tooltypeid&", _
"&faid&", "&processid&", '"&originatorname&"', _
'"&originatoremail&"', '"&quarter&"', '"&currmasterrev&"', _
'"&falreviewername&"'"
Set oCmd = CreateObject("ADODB.Command")
oCmd.ActiveConnection = conn
oCmd.CommandText = adddcoecnsql
oCmd.CommandType = adCmdStoredProc
Response.Write("<br>command text: "&oCmd.CommandText)
oCmd.Parameters.Append oCmd.CreateParameter("retval", _
adInteger, adParamReturnValue)
oCmd.Execute
Response.Write("<br>retval: "& ocmd(0))
%>

Sent via Deja.com http://www.deja.com/
Before you buy.



Mon, 09 Sep 2002 03:00:00 GMT  
 Getting syntax error when trying to execute a stored proc
Yes. I also tried using the manually created constants like one example
I found... No luck there, either.
Back to using "adovbs.inc." Include file exists and isn't producing an
error. I looked at the include file. Doesn't seem corrupted or
anything. Not getting any errors that any variables are undefined.

Quote:

> Have you included the "adovbs.inc" file that defines all of the

adBlahBlah constants?
Quote:

> --
> Michael Harris
> MVP Scripting




Quote:
> I'm trying to execute a stored procedure in order to perform an insert
> on a table. I'm executing the stored proc this way so that I can get
> the returned value for the end user.
> I'm getting "Syntax error or access violation" at oCmd.execute. I
don't
> get this error if I comment out the "command type" but then the stored
> proc doesn't work.
> I've been staring at this so long that I think I'm missing an obvious
> problem that is causing this error. Any ideas?
> <%
> set conn=server.createobject("adodb.connection")
> conn.open Application("APP_DB_CONNECTION_STRING"), _
> Application "APP_USERNAME"), Application("APP_PASSWORD")
> adddcoecnsql = "usp_adddco "&fabid&", "&tooltypeid&", _
> "&faid&", "&processid&", '"&originatorname&"', _
> '"&originatoremail&"', '"&quarter&"', '"&currmasterrev&"', _
> '"&falreviewername&"'"
> Set oCmd = CreateObject("ADODB.Command")
> oCmd.ActiveConnection = conn
> oCmd.CommandText = adddcoecnsql
> oCmd.CommandType = adCmdStoredProc
> Response.Write("<br>command text: "&oCmd.CommandText)
> oCmd.Parameters.Append oCmd.CreateParameter("retval", _
> adInteger, adParamReturnValue)
> oCmd.Execute
> Response.Write("<br>retval: "& ocmd(0))
> %>

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Mon, 09 Sep 2002 03:00:00 GMT  
 Getting syntax error when trying to execute a stored proc
Anyone able to help on this?


Quote:

> Yes. I also tried using the manually created constants like one
example
> I found... No luck there, either.
> Back to using "adovbs.inc." Include file exists and isn't producing an
> error. I looked at the include file. Doesn't seem corrupted or
> anything. Not getting any errors that any variables are undefined.


> > Have you included the "adovbs.inc" file that defines all of the
> adBlahBlah constants?

> > --
> > Michael Harris
> > MVP Scripting



> > I'm trying to execute a stored procedure in order to perform an
insert
> > on a table. I'm executing the stored proc this way so that I can get
> > the returned value for the end user.
> > I'm getting "Syntax error or access violation" at oCmd.execute. I
> don't
> > get this error if I comment out the "command type" but then the
stored
> > proc doesn't work.
> > I've been staring at this so long that I think I'm missing an
obvious
> > problem that is causing this error. Any ideas?
> > <%
> > set conn=server.createobject("adodb.connection")
> > conn.open Application("APP_DB_CONNECTION_STRING"), _
> > Application "APP_USERNAME"), Application("APP_PASSWORD")
> > adddcoecnsql = "usp_adddco "&fabid&", "&tooltypeid&", _
> > "&faid&", "&processid&", '"&originatorname&"', _
> > '"&originatoremail&"', '"&quarter&"', '"&currmasterrev&"', _
> > '"&falreviewername&"'"
> > Set oCmd = CreateObject("ADODB.Command")
> > oCmd.ActiveConnection = conn
> > oCmd.CommandText = adddcoecnsql
> > oCmd.CommandType = adCmdStoredProc
> > Response.Write("<br>command text: "&oCmd.CommandText)
> > oCmd.Parameters.Append oCmd.CreateParameter("retval", _
> > adInteger, adParamReturnValue)
> > oCmd.Execute
> > Response.Write("<br>retval: "& ocmd(0))
> > %>

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Tue, 10 Sep 2002 03:00:00 GMT  
 Getting syntax error when trying to execute a stored proc


Fri, 19 Jun 1992 00:00:00 GMT  
 Getting syntax error when trying to execute a stored proc
I am getting a syntax error when I try to execute a stored proc against
a SQL Server 6.5 database.
*
The command object executes fine until I add oCmd.CommandType =
adCmdStoredProc.
*
Here's my code that works. (I did use the adovbs.inc file...) From what
I can figure out, I have to add the commandtype line above in order to
get the return value from the stored proc...or is there another way?
*
Set oCmd = CreateObject("ADODB.Command")
oCmd.ActiveConnection = conn
oCmd.CommandText = adddcoecnsql
oCmd.Execute

Thanks for any help...

Sent via Deja.com http://www.deja.com/
Before you buy.



Fri, 20 Sep 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Page fault error occures when executing store proc

2. PBM: Getting error 0x80040E14 when executing a stored procedure

3. Stored Proc syntax help

4. Memory Full While Trying to Connect To SQL Server 2000 Stored Proc With OLEDB

5. Problem Executing Stored Proc more than once

6. Executing stored proc. from VB returns before complete

7. Executing Visual FoxPro Stored Proc from VB

8. Executing stored proc with Output params without ADO Command object

9. Can a stored proc execute asynch?

10. executing a packaged stored proc on Oracle

11. Executing stored proc. from VB returns before complete

12. Stored proc parms NOT getting set

 

 
Powered by phpBB® Forum Software