INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Execute a SP using Classic ASP

Execute a SP using Classic ASP

(OP)
For some reason I cannot execute this Stored procedure VIA ASP.

Here is my code:

<%

dim db_conn

db_conn = "Provider=MSDAORA;Data Source=Pilot;User Id=USer1;Password=SecretPassword;"
set conn = server.createobject("adodb.connection")
set Cmd = Server.CreateObject("ADODB.Command")
'-------------------------------------------------------
conn.open (db_conn)
'-------------------------------------------------------
set rs = Server.CreateObject("ADODB.RecordSet")

sSQL = "exec dbo.return_book_titles(3340, 'Lassie', 61368359)"
set rs = conn.execute(sSQL)

if (rs.bof and rs.eof) then
response.Write "<span class=""error"">No Record Found</span>"
response.End
end if %>

RE: Execute a SP using Classic ASP

(OP)
Please note I am able to add a simple SELECT statement in the sQL string and it works fine and I am also able to run the SP via PL/SQL however I cannot execute the SP...
I

RE: Execute a SP using Classic ASP

(OP)
I now encounter this error message. Issue with calling the SP:

Microsoft OLE DB Provider for Oracle error '80040e14'

ORA-00900: invalid SQL statement

RE: Execute a SP using Classic ASP

(OP)
Changed Exec with Call and this surely did the trick..

RE: Execute a SP using Classic ASP

As a general tip: if your web code permissions don't allow for the execution of a Stored Procedure, a work around is to create a trigger in the database that executes the SP.

For example, if your web code permissions does allow inserting records into a table then use that capability to insert, which executes the SP triggered by the insert. Obviously, you create the table in the DB and add the trigger for the SP in the DB.

The table itself can be a "junk" table. And the trigger that executes the code you desire can include clearing the "junk" table itself to keep things clean.

I've done this to get around permissions issues in ASP and PHP. I've found this method handy, for example, to execute DBMail (SQL Server) even without DBMail access permissions in the web code.

Dave idea
[http://flashspot.com]

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close