Disconnected Recordsets 
Author Message
 Disconnected Recordsets

I've been trying to make a Disconnected Recordset in Jscript for the past
couple hours. Has anyone out there ever gotten it to work. I'm begining to
think it isn't possible.


Mon, 21 Jul 2003 02:57:19 GMT  
 Disconnected Recordsets
It's plenty possible, Dan.  As Marks Sikes put it (over a year ago):

"With the most recent ADO v2.1, this happens.  A quick inspection using
VC shows:  assigning a VBScript "Nothing" value, as shown in literally
all examples, assigns a variant of type VT_DISPATCH (i.e. IDispatch),
with a null object reference (i.e. 0x00000000).  However, JScript uses
a variant of type VT_EMPTY for unassigned variables, and type VT_NULL
for variables set to null:

    // The variable "Nothing" below will be a variant tagged
VT_EMPTY     // The variable "Null" below will be a variant tagged
VT_NULL

    var Nothing, Null = null;"

So, here are your 3 solutions:

1) Include a section of VBScript to return Nothing:

<script language="VBScript" runat="server">
Function GetNothing()
' I forget if you need set here or not...
Set GetNothing = Nothing
End Function

2) Get a reference to nothing from a new recordset object:

var objRS = Server.CreateObject("ADODB.Recordset");
var Nothing = objRS.ActiveConnection;
// more code here
var objRS.ActiveConnection = Nothing; // this now works

3) Use MS developer Peter Torr's component:
http://www.netspace.net.au/~torrboy/code/jargutil/

There you go!
Richard



Quote:
> I've been trying to make a Disconnected Recordset in Jscript for the
past
> couple hours. Has anyone out there ever gotten it to work. I'm
begining to
> think it isn't possible.

Sent via Deja.com
http://www.deja.com/


Mon, 21 Jul 2003 06:41:13 GMT  
 Disconnected Recordsets
WOOHOO!
Thanks Richard. =)
Quote:

> It's plenty possible, Dan.  As Marks Sikes put it (over a year ago):

> "With the most recent ADO v2.1, this happens.  A quick inspection using
> VC shows:  assigning a VBScript "Nothing" value, as shown in literally
> all examples, assigns a variant of type VT_DISPATCH (i.e. IDispatch),
> with a null object reference (i.e. 0x00000000).  However, JScript uses
> a variant of type VT_EMPTY for unassigned variables, and type VT_NULL
> for variables set to null:

>     // The variable "Nothing" below will be a variant tagged
> VT_EMPTY     // The variable "Null" below will be a variant tagged
> VT_NULL

>     var Nothing, Null = null;"

> So, here are your 3 solutions:

> 1) Include a section of VBScript to return Nothing:

> <script language="VBScript" runat="server">
> Function GetNothing()
> ' I forget if you need set here or not...
> Set GetNothing = Nothing
> End Function

> 2) Get a reference to nothing from a new recordset object:

> var objRS = Server.CreateObject("ADODB.Recordset");
> var Nothing = objRS.ActiveConnection;
> // more code here
> var objRS.ActiveConnection = Nothing; // this now works

> 3) Use MS developer Peter Torr's component:
> http://www.netspace.net.au/~torrboy/code/jargutil/

> There you go!
> Richard



> > I've been trying to make a Disconnected Recordset in Jscript for the
> past
> > couple hours. Has anyone out there ever gotten it to work. I'm
> begining to
> > think it isn't possible.

> Sent via Deja.com
> http://www.deja.com/



Mon, 21 Jul 2003 07:33:49 GMT  
 Disconnected Recordsets
// Disconnected Recordset Example //

var adVarChar = 200;

var rs = new ActiveXObject("ADODB.Recordset");

rs.Fields.Append("FirstName", adVarChar, 255);
rs.Fields.Append("LastName",  adVarChar, 255);

rs.Open();

rs.AddNew();
rs.Fields("FirstName").Value = "Fred";
rs.Fields("LastName").Value  = "Flintstone";
rs.AddNew();
rs.Fields("FirstName").Value = "Barney";
rs.Fields("LastName").Value  = "Rubble";
rs.AddNew
rs.Fields("FirstName").Value = "George";
rs.Fields("LastName").Value  = "Jetson";

for (rs.MoveFirst(); !rs.EOF; rs.MoveNext) {
  WScript.echo(rs.Fields("Firstname").Value, rs.Fields("Lastname").Value);

Quote:
}

rs.Close();

=-=-=
Steve
-=-=-


Quote:
> I've been trying to make a Disconnected Recordset in Jscript for the past
> couple hours. Has anyone out there ever gotten it to work. I'm begining to
> think it isn't possible.



Mon, 21 Jul 2003 06:12:47 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How can I creat an Identity field in a Disconnected Recordset

2. Disconnected Recordset in JScript

3. Disconnected Recordsets with Javascript

4. referencing fields in a disconnected recordset

5. Disconnected recordset

6. Disconnected recordset vs. array

7. Disconnected RecordSet

8. create disconnected recordset with jscript

9. ASP and ADO disconnected recordsets

10. Function returning disconnected recordset, need help.

11. Disconnected Recordset Problem

12. Enforce referential integrity in a disconnected recordset?

 

 
Powered by phpBB® Forum Software