Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] RE: Disconnected Recordset


  • From: javascript@xxxxxxxxxx (Michael Dougherty)
  • Subject: [Javascript] RE: Disconnected Recordset
  • Date: Mon, 24 Feb 2003 13:26:38 -0500

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.