Solved

disconnected recordset in JScript?

Posted on 2002-06-21
2
520 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

729 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