Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question retrieving @@identity value from stored proc using MSXML2.DOMDocument40

    I am a little lost... here is my stored procedure:

    ALTER PROCEDURE [dbo].[spSaveOrders]
    @order_num int = null OUTPUT ,
    @hdnCartString text, --1
    @hdnPrice varchar(20), --2
    @hdnQuantity int, --3
    @hdnProductName varchar(100), --4
    @hdnUserID varchar(20), --5
    @userName varchar(30), --6
    @hdnTotal varchar(10), --7
    @txtFName varchar(20) = null, --8
    @txtLName varchar(30) = null, --9
    @txtAddress1 varchar(100) = null, --10
    @txtAddress2 varchar(100) = null, --11
    @txtCity varchar(50) = null, --12
    @txtState varchar(2) = null, --13
    @txtZip int = null, --14
    @txtPhone1 int, --15
    @txtPhone2 int = null, --16
    @txtPhone3 int = null, --17
    @txtFax int = null, --18
    @txtEmail varchar(50) = null, --19
    @txtShippingFName varchar(20)= null, --20
    @txtShippingLName varchar(30)= null, --21
    @txtShippingAddress1 varchar(100) = null, --22
    @txtShippingAddress2 varchar(100) = null, --23
    @txtShippingCity varchar(50) = null, --24
    @txtShippingState varchar(2) = null, --25
    @txtShippingZip int = null, --26
    @txtShippingPhone int = null, --27
    @txtShippingFax int = null, --28
    @txtShippingEmail varchar(50) = null --29

    AS

    insert into orders
    (userID,
    cart_string,
    total)

    VALUES
    (@hdnUserID,
    @hdnCartString,
    @hdnTotal)

    Update Users
    set fname =@txtFName,
    lname =@txtLName,
    address1 = @txtAddress1,
    address2 = @txtAddress2,
    city = @txtCity,
    state = @txtState,
    zip = @txtZip,
    phone = @txtPhone1,
    tollfree = @txtPhone2,
    cell = @txtPhone3,
    fax = @txtFax,
    email = @txtEmail,
    shipAddress1 = @txtShippingAddress1,
    shipAddress2 = @txtShippingAddress2,
    shipCity = @txtShippingCity,
    shipState = @txtShippingState,
    shipZip = @txtShippingZip,
    shipPhone = @txtShippingPhone,
    shipFax = @txtShippingFax,
    shipEmail = @txtShippingEmail,
    createDate = getDate()
    where userName = @userName


    SELECT @order_num = @@identity FROM orders
    -----------------------------------------------------------------------------------
    This is how my vb code is(shortened version):

    Dim objXMLSave As MSXML2.DOMDocument40
    Dim objNode As MSXML2.IXMLDOMNode
    Dim objDAL As NSDataAccess.clsNSExecute

    Set oXMLPayment = New MSXML2.DOMDocument40
    oXMLPayment.loadXML (bstrXMLIn)


    strCart = oXMLPayment.documentElement.selectSingleNode("//cart_string").Text '1
    strhdnPrice = oXMLPayment.documentElement.selectSingleNode("//price").Text '2 ...

    'Use Data Access Layer to save to the db
    Set objDAL = mobjOContext.CreateInstance("NSDataAccess.clsNSExecute")
    Set objXMLSave = New MSXML2.DOMDocument40
    Set objXMLSave = GetNewXMLDoc("root")

    AddElement objXMLSave, "stored_proc", "spSaveOrders"
    AddElement objXMLSave, "udl", "c:\udl\marketing.udl"
    AddElement objXMLSave, "params", ""
    AddAttribute objXMLSave, "params", "record", "yes"
    Set objNode = objXMLSave.documentElement.selectSingleNode("params")

    With objXMLSave
    AddElementToNode objNode, "cart_string", strCart '1
    AddElementToNode objNode, "price", strhdnPrice '2 ....

    End With

    strMsg = CStr(objDAL.Execute(objXMLSave.XML))

    Set objNode = Nothing
    Set objXMLSave = Nothing
    Set objDAL = Nothing
    Set oXMLPayment = Nothing

    Exit Function

    End Function


    Private Sub ObjectControl_Activate()
    Set mobjOContext = GetObjectContext()
    End Sub


    ' Since this is a VB DLL, contexts cannot be pooled
    Private Function ObjectControl_CanBePooled() As Boolean
    ObjectControl_CanBePooled = False
    End Function

    ' Dereferences the object context on dereferencing of DLL by client
    Private Sub ObjectControl_Deactivate()
    Set mobjOContext = Nothing
    End Sub
    -----------------------------------------------------------------------------------
    What I need is to get the @order_num value to set to a string to call its' value for a conformation of order email. Anyone have any suggestions. Thank you for your time.
    Last edited by carver_mark; 10-22-2003 at 07:11 PM.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,966
    Thanks
    0
    Thanked 236 Times in 233 Posts
    This is a Javascript forum. You should have posted this to ASP forum.

  • #3
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Glenn, your input was very usefull!!!!


  •  

    Posting Permissions

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