PDA

View Full Version : Do not Open Exclusively



details
08-01-2002, 09:14 PM
How can I rewrite this function to open as shared instead of exclusivly. I am getting an error of file already in use?



function GetNextOrderID()
dim Conn
dim rsMaxOrder

set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConString

set rsMaxOrder = Server.CreateObject("ADODB.Recordset")
rsMaxOrder.Open "SELECT MAX(orderID) AS LastID FROM itemsOrdered", Conn, adOpenStatic, adLockReadOnly, adCmdText

GetNextOrderID = rsMaxOrder("LastID") + 1

rsMaxOrder.Close
set rsMaxOrder = Nothing

Conn.Close
set Conn = Nothing

end function

whammy
08-04-2002, 02:14 AM
If you're using AutoNumber, you can't write it to the database, it does it for you automatically. :)