...

View Full Version : rs.open Conn, adOpenDynamic, adLockOptimistic, adCmdTable



details
08-01-2002, 05:32 PM
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

Roy Sinclair
08-01-2002, 06:55 PM
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

gven45
08-05-2011, 08:23 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum