Aside from some obvious problems with your code (eg
rsTemp=Server.CreateObject("ADODB.Connection") is missing the SET keyword.
As well, why are you calling your connection rsTemp?), which David has
alluded to, there is another big problem with your code. You should *never*
store an ADO connection object in a session variable, since this persists a
connection for as long as the session is active = 500 active sessions = 500
active connections. You'll bog down your database, and you'll probably run
into lisencing issues. You also lose any benefit from ODBC Connection or
OLEDB Resource pooling.
Always create and open the connection on each page, and then close and
dispose of the object as soon as it is not needed:
: session("db_con").execute(sql)
is the offending code - you are storing the connection object in a session
variable.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmdac/html
/pooling2.asp
explains ODBC/OLEDB connection/resource pooling.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: rsTemp = Server.CreateObject("ADODB.Connection")
:
: sql="ALTER TABLE MainCategory ADD (hasChild integer NULL)"
: set rsTemp = session("db_con").execute(sql)
:
: sql="Update maincategory set hasChild=0 where id=1"
: set rsTemp = session("db_con").execute(sql)
:
: sql="select * from maincategory where hasChild=0"
: set rsTemp = session("db_con").execute(sql)
:
: if not rsTemp.EOF then
: response.write("worked")
: end if
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~