Urgent! return variavle from stored proc

Results 1 to 2 of 2

Thread: Urgent! return variavle from stored proc

  1. #1
    Ruby Ooi Guest

    Default Urgent! return variavle from stored proc

    How can I return a variable from a execution of a stored proc instead of recordset in ASP code??? Is there any wrong with my code???<BR><BR>&#060;% set conn = server.createobject("ADODB.Connection")<BR> conn.Open "hrmisdba", "sa", ""<BR> dim vTryID <BR> dim theName <BR> theName = request.form("Name")<BR> sql="sp_ChildrenInsert &#039"& theName &"&#039" <BR> vTryID = conn.Execute(sql)%&#062;<BR><BR>If this code is correct then why the below code got error??<BR>response.write vTryID ? give me an error<BR><BR>the store proc is as follow :----<BR>Create PROCEDURE sp_ChildrenInsert <BR>(<BR> @Child_Name VARCHAR(50) <BR>)<BR>AS<BR>BEGIN<BR> INSERT INTO TblTryIdentity<BR> ( <BR> Child_Name<BR> )<BR> VALUES <BR> ( <BR> @Child_Name<BR> )<BR> Select @@IDENTITY AS &#039ID&#039<BR><BR>END

  2. #2
    Join Date
    Dec 1969

    Default RE: Urgent! return variavle from stored proc

    The stored procedure returns an entire recordset object. So, you need to do:<BR><BR>Dim objRS<BR>Set objRS = objConn.Execute(strSQL)<BR><BR>&#039The ID is now:<BR>Dim iID<BR>iID = objRS("ID").Value<BR><BR>Hope this helps!

Posting Permissions

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