[Javascript] RE: Disconnected Recordset
Peter Brunone
peter at brunone.com
Mon Feb 24 13:14:46 CST 2003
I'm not sure what the magic word is for that ActiveConnection parameter --
I've never been much of a recordset/cursor man myself -- but you might want
to try using the GetRows() method of the recordset to dump it to an array...
and then just get rid of the RS entirely.
Just a thought...
Peter
|-----Original Message-----
|From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
|Behalf Of Michael Dougherty
|Sent: Monday, February 24, 2003 12:27 PM
|To: javascript at LaTech.edu
|Subject: [Javascript] RE: Disconnected Recordset
|
|
|the following works fine:
|<script type='text/javascript'>
| var oCN = new ActiveXObject("ADODB.Connection") ;
| var oRS = new ActiveXObject("ADODB.Recordset") ;
|
| oRS.CursorLocation = 3 ; /* Client-side */
| oRS.CursorType = 3 ; /* Static */
| oRS.LockType = 1 ; /* ReadOnly */
|
| oCN.open ("Server=MyServer;Database=MyDB;User=Me;Pwd=MyPwd'") ;
| oRS.open ("Select * from MyTable",oCN) ;
|
| alert( oRS.recordCount ) ;
|
| oRS.close ;
| oCN.close ;
|</script>
|
|What i want to do is this:
|<script type='text/javascript'>
| var oCN = new ActiveXObject("ADODB.Connection") ;
| var oRS = new ActiveXObject("ADODB.Recordset") ;
|
| oRS.CursorLocation = 3 ; /* Client-side */
| oRS.CursorType = 3 ; /* Static */
| oRS.LockType = 1 ; /* ReadOnly */
|
| oCN.open ("Server=MyServer;Database=MyDB;User=Me;Pwd=MyPwd'") ;
| oRS.open ("Select * from MyTable",oCN) ;
|
| oRS.activeConnection = [whatever it takes to disconnect this recordset] ;
|
| oCN.close ; /* close the connection to the DB */
|
| /* use the recordset - possibly leaving it open for a while */
| alert( oRS.recordCount ) ;
|
| oRS.close ;
|</script>
|
| If you don't set the activeConnection to NULL before closing the oCN
|connection object, it will cause the oRS recordset object to also close.
|
|
|> I guess the first question would be, how did you get client-side
|>javascript to connect to a database? Once we understand the context,
|perhaps we'll be
|>able to help more.
|
|
|_______________________________________________
|Javascript mailing list
|Javascript at LaTech.edu
|https://lists.LaTech.edu/mailman/listinfo/javascript
|
More information about the Javascript
mailing list