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 Coder
    Join Date
    Jul 2002
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    rs.open Conn, adOpenDynamic, adLockOptimistic, adCmdTable

    Is the rs.open line correct?


    function GetNextOrderID()
    dim Cmd
    dim rs

    cmd = "SELECT MAX(orderID) AS LastID FROM itemsOrdered

    rs.open Conn, adOpenDynamic, adLockOptimistic, adCmdTable

    GetNextOrderID = VAL(0 & rs("LastID")) + 1

    end function
    If you don't do it this year, you will be one year older when you do. "Warren Miller"

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is the rs.open line correct?
    No. The rest of the routine has problems too. I will assume that Conn refers to a connection object that already exists.

    function GetNextOrderID()
    dim Cmd
    dim rs

    cmd = "SELECT MAX(orderID) AS LastID FROM itemsOrdered

    set rs = Server.CreateObject("ADODB.Connection")
    rs.open Cmd, Conn, adOpenDynamic, adLockOptimistic, adCmdText

    GetNextOrderID = VAL(0 & rs("LastID")) + 1

    end function

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    rs.open line is wrong I think (I've been wrong before). The Select should be pointing to the table, not the file so take a look at the functions in the UDf to see how to handle that.


  •  

    Posting Permissions

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