Using Output Parameters with Stored Proc

Results 1 to 4 of 4

Thread: Using Output Parameters with Stored Proc

  1. #1
    RipCat Guest

    Default Using Output Parameters with Stored Proc

    I&#039m trying to use an output parameter from a stored proc to get the @@IDENTITY back to my calling ASP page. I&#039m calling stored proc with parameters and doing insert.<BR><BR>Here&#039s the ASP calling stuff:<BR><BR> lsProductsMasterSaveSql = "up_ProductsMasterInsert "<BR> lsProductsMasterSaveSql = lsProductsMasterSaveSql & "&#039" & Trim(Request.Form("txtPartNumber")) & "&#039, "<BR> lsProductsMasterSaveSql = lsProductsMasterSaveSql & CInt(Request.Form("cboProductsClass")) & ", "<BR> lsProductsMasterSaveSql = lsProductsMasterSaveSql & CInt(Request.Form("cboManufacturers")) & ", "<BR> lsProductsMasterSaveSql = lsProductsMasterSaveSql & "&#039" & lcDescription & "&#039, "<BR> lsProductsMasterSaveSql = lsProductsMasterSaveSql & CCur(Request.Form("txtCost")) & ", "<BR> lsProductsMasterSaveSql = lsProductsMasterSaveSql & CCur(Request.Form("txtList")) & ", "<BR> lsProductsMasterSaveSql = lsProductsMasterSaveSql & "&#039" & Trim(Request.Form("txtWeight")) & "&#039, "<BR> lsProductsMasterSaveSql = lsProductsMasterSaveSql & "&#039" & Trim(Request.Form("txtImageName")) & "&#039, " <BR> lsProductsMasterSaveSql = lsProductsMasterSaveSql & "&#039" & lcPartId & "&#039" <BR><BR>I then just use execute method of connection object to call stored proc...<BR><BR>lcPartId = ocnProductsMasterSaveSql.Execute(lsProductsMasterS aveSql)<BR><BR>Here&#039s my stored procedure:<BR><BR>Alter Procedure up_ProductsMasterInsert<BR><BR> @PartNumber nChar(25),<BR> @ProductsClassId Int,<BR> @MfgId Int,<BR> @Description nChar(75),<BR> @Cost Money,<BR> @List Money,<BR> @Wgt nChar(10),<BR> @ImageSource nChar(25),<BR> @NewPartId Int OUTPUT<BR><BR>As<BR><BR> INSERT ProductsMaster<BR> (PartNumber,ProductsClassId,MfgId,Description,Cost , List, Wgt, ImageSource)<BR> VALUES(@PartNumber, @ProductsClassId, @MfgId, @Description, @Cost, @List, @Wgt, @ImageSource)<BR><BR> SELECT @NewPartId = @@IDENTITY<BR><BR>Return <BR><BR>This stored proc is already created on server...Runs fine without the NewPartId output stuff...(i.e. Insert without trying to return value)...<BR><BR>When I try to display the value for lcPartId:<BR><BR>Response object error &#039ASP 0185 : 8002000e&#039 <BR><BR>Missing Default Property <BR><BR>A default property was not found for the object. <BR><BR>Thanx in advance...<BR><BR>RipCat

  2. #2
    Join Date
    Dec 1969

    Default RE: Using Output Parameters with Stored Proc

    You&#039ll have to use a ADO Command object:<BR>

  3. #3
    RipCat Guest

    Default RE: Have to Use the command object?

    Do I have to use the command object...I am passing several parameters and would like not to have to define all...Is there not a way to use like I have...???...

  4. #4
    sm549 Guest

    Default RE: Have to Use the command object?

    If your stored procedure returns a resultset you can use a recordset object, ie if the last line of the sp was:<BR><BR>**SELECT @NewPartId<BR><BR>you could access it with oRS(0)...<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