showing a value returned by a stored procedure

Results 1 to 2 of 2

Thread: showing a value returned by a stored procedure

  1. #1
    Archana Guest

    Default showing a value returned by a stored procedure

    I have a stored procedure that returns an integer value..<BR>(on the SQL-Server)<BR>It requires 2 parameters and not a single output parameter...<BR><BR>How can I access the return value from my asp programme using Command ADObject?<BR><BR>My Stored Procedure:<BR>===================<BR><BR>create procedure memberscan @memberid char(30), @email char(30)<BR>as<BR>set nocount off<BR><BR>declare @flag int <BR>select @flag = 0 <BR><BR>if exists (select memberid from member_details where memberid= @memberid)<BR>begin <BR> select @flag=@flag+1 <BR>end <BR>if exists (select email from member_details where email = @email)<BR>begin <BR> select @flag= @flag + 2<BR>end<BR>return @flag<BR><BR><BR><BR>My Code:<BR>=======<BR>set objComm = Server.CreateObject("ADODB.Command")<BR> tiveConnection = strConnect<BR>objComm.commandType = adCmdStoredProc<BR>objComm.commandText = "memberscan"<BR><BR>Set ObjParam = objComm.createParameter("member",adChar,adParamInp ut,30)<BR>objComm.Parameters.append ObjParam<BR>objComm.Parameters("memberid") = Request("member")<BR><BR>Set ObjParam = objComm.createParameter("email",adChar,adParamInpu t,30)<BR>objComm.Parameters.append ObjParam<BR>objComm.Parameters("email") = Request("email")<BR><BR>Set ObjParam = objComm.createParameter ("returnval",adInteger,adParamReturnValue)<BR>objC omm.Parameters.append ObjParam<BR><BR>objcomm.execute<BR>ctr = objcomm.Parameters("returnval")<BR>Response.write "CTR = " & ctr<BR><BR>I get the foll. error-<BR>Too many arguments were supplied for procedure.<BR>Thanks<BR>Archana<BR><BR>

  2. #2
    Nathen Grass Guest

    Default RE: showing a value returned by a stored procedure

    To use the Command object the way you are you need to specify an Output parameter in your Stored Proc:<BR><BR>create procedure memberscan <BR>&nbsp;&nbsp;&nbsp;@memberid char(30), <BR>&nbsp;&nbsp;&nbsp;@email char(30),<BR>&nbsp;&nbsp;&nbsp;@flag int OUTPUT<BR>as<BR>...<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts