Solved

disconnected recordset in JScript?

Posted on 2002-06-21
2
494 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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

14 Experts available now in Live!

Get 1:1 Help Now