Solved

disconnected recordset in JScript?

Posted on 2002-06-21
2
491 Views
Last Modified: 2012-08-13
How do i create disconnected recordset in Javascript?

In VB it's easy:

Set rs.ActiveConnection = Nothing

But how do you do in JS? (and JS only)

these DO NOT work:
rs.ActiveConnection = null;
rs.ActiveConnection = undefined;
rs.ActiveConnection = new Object(null);
rs.ActiveConnection.Close


0
Comment
Question by:chiche
2 Comments
 
LVL 20

Accepted Solution

by:
jitganguly earned 200 total points
ID: 7099600
Here it is
<%@Language="JScript"%>
<!-- Include file for JScript ADO Constants -->
<!--#include File="adojavas.inc"-->
<%
     // Connection string.
     var strCon = "Provider=sqloledb;Data Source=myServer;Initial Catalog=Northwind;User Id=myUser;Password=myPassword";
             
     // Create the required ADO objects.
     conn = Server.CreateObject("ADODB.Connection");
     rs = Server.CreateObject("ADODB.recordset");
             
     // Open the connection.
     conn.Open(strCon);
     
     // Retrieve some records.
     var strSQL = "Select * from Shippers";
     rs.CursorLocation = adUseClient;
     rs.Open(strSQL, conn, adOpenStatic, adLockOptimistic);

     // Disconnect the recordset.
     DisconnectRecordset(rs);
     
     // Release the connection.
     conn.Close();

     // Check the status of the connection.
     Response.Write("<BR> Connection.State = " + conn.State);
     
     conn = null;
         
     // Use the diconnected recordset here.
     
     // Release the recordset.
     rs.Close();
     rs = null;
%>

<SCRIPT LANGUAGE="VBScript" RUNAT="SERVER">
Sub DisconnectRecordset(rs)
     Set rs.ActiveConnection = Nothing
End Sub
</SCRIPT>


http://support.microsoft.com/default.aspx?scid=kb;en-us;Q289531
0
 

Author Comment

by:chiche
ID: 7099618
jitganguly , you are not answering my question since I specified "JS only". I already knew this method of mixing VBScript with JSScript.

But I give you the points anyway because you included a link to the Microsoft Web Site which basically proves that there is no other way.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now