468,242 Members | 1,888 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

Calling Stored Procedure from an ASP Page

Hello,
I have a stored procedure named as

usp_CheckLogin with two parameters

as @usID, @Password

also values of these parameters are to be extracted using Request.Form from
the fields in the forms. Now How do I call this stored procedure from an ASP
Page using a Connection object in Server Tags <% %>. Also this stored
procedure returns a Numeric value as "RETURN_VALUE". please give me the
syntax. This stored Procedure is a part of Session Management module.

thank you
May 29 '07 #1
2 2464
"anoop" wrote:
I have a stored procedure named as

usp_CheckLogin with two parameters

as @usID, @Password

also values of these parameters are to be extracted using Request.Form
from
the fields in the forms. Now How do I call this stored procedure from an
ASP
Page using a Connection object in Server Tags <% %>.
Take a look at the final section here, titled "Execute a stored procedure as
a native method of a Connection object". Your problem seems well-suited for
this approach:

http://msdn.microsoft.com/library/en...connection.asp

In other words, you can use an open connection like this:

objConn.usp_CheckLogin strUserID, strPassword
Also this stored procedure returns a Numeric value as
"RETURN_VALUE". please give me the syntax. This stored
Procedure is a part of Session Management module.
Returns? Would that be with a RETURN statement or a SELECT statement? The
answers are quite different.

If your procedure ends with...

SELECT xxx AS RETURN_VALUE

....then you can simply append a parameter and stick a recordset object
there...

objConn.usp_CheckLogin strUserID, strPassword, objRS

....and read from the recordset as usual:

If objRS.Fields("RETURN_VALUE").Value = {whatever} Then
If, on the other hand, your procedure uses RETURN, you may have to use an
explicit command object:
http://msdn.microsoft.com/library/en...objcommand.asp


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

May 29 '07 #2
anoop wrote:
Hello,
I have a stored procedure named as

usp_CheckLogin with two parameters

as @usID, @Password

also values of these parameters are to be extracted using
Request.Form from the fields in the forms. Now How do I call this
stored procedure from an ASP Page using a Connection object in Server
Tags <% %>. Also this stored procedure returns a Numeric value as
"RETURN_VALUE". please give me the syntax. This stored Procedure is a
part of Session Management module.
http://groups.google.com/group/micro...09dc1701?hl=en

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
May 29 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Bob Murdoch | last post: by
18 posts views Thread by Jarrod Morrison | last post: by
2 posts views Thread by Woody Splawn | last post: by
4 posts views Thread by raghuvendra | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.