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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Stored Procedure Call 3

Status
Not open for further replies.

ftc128

MIS
May 26, 2005
18
US
I have a stored procedure that I want to call from an ASP. The SP does not return any records, instead it runs a DTS package on the server via xp_cmdshell. In looking up examples of how to call stored procs from ASPs, I've found only examples that return recordsets. So I'm beginning to think that my use of the oCommand.Execute method is throwing back a syntax error message because I can't figure out the syntax in a 'no recordet' situation. Can someone show me a code example of using the .Execute method for a stored proc that returns no rows?

Thanks
 
oCommand.Execute("EXEC storedProcName") should work fine.

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
headbang.gif
[rockband]
headbang.gif
 
Well, something's still missing: ie, I still get a syntax error message. Can you tell me what's wrong with this?


dim oCmd
set oCmd=server.createobject("ADODB.command")
set oCmd.ActiveConnection = oConn1

' oCmd.CommandText = "EXEC ila.dbo.AR-dts"
' oCmd.CommandType = 4
oCmd.Execute("EXEC ila.dbo.AR-dts")

You can see where I've tried to set the Command Type and Text. Both to no avail.

Thanks
 
I found out why it wasn't working despite good advice from everybody. It didn't like the hyphen in my stored proc name. I'd named it AR-dts, and I kept getting a message saying syntax error near 'dts'. So on a hunch I removed the hyphen and it worked perfectly. So that little nugget of truth might be useful to somebody.
 
ftc128, good job on catching that. I never knew that a hyphen would screw up a stored procedure call like that. A star for you!

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
headbang.gif
[rockband]
headbang.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top