Calling Stored Procedure from an ASP Page

Calling Stored Procedure from an ASP Page

am 29.05.2007 06:38:07 von Anoop

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

Re: Calling Stored Procedure from an ASP Page

am 29.05.2007 08:03:32 von Dave Anderson

"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-us/ado270/htm/mdobjconn ection.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-us/ado270/htm/mdobjcomm and.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.

Re: Calling Stored Procedure from an ASP Page

am 29.05.2007 15:11:09 von reb01501

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/microsoft.public.inetserver.a sp.general/msg/5d3c9d4409dc1701?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.