CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   ASP (http://www.codingforums.com/forumdisplay.php?f=8)
-   -   rs.open Conn, adOpenDynamic, adLockOptimistic, adCmdTable (http://www.codingforums.com/showthread.php?t=3149)

details 08-01-2002 05:32 PM

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

Roy Sinclair 08-01-2002 06:55 PM

Quote:

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.


All times are GMT +1. The time now is 11:06 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.