Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

jscript null vs vbscript Nothing

2 views
Skip to first unread message

Maciej Warszawski

unread,
Feb 28, 2001, 9:14:16 PM2/28/01
to
the same or not the same that is the question,

I have doubts, when I tried to set Recordset ActiveConnection property to
null (Active Server Pages) I have the following error:

ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.

I red Jscript reference from AtoZ and nothing. I used Recordset Open()
method with explicit Connection object and SQL command as a Source and like
says ADO API Reference in MSDN, ActiveConnection Should be read/write
property and it is, but it does not accepts null as a value, why I thought
that null (JS) is the same as Nothing (VBS)

Please help

Maciej Warszawski

Randy Hunt

unread,
Feb 28, 2001, 9:32:58 PM2/28/01
to
Maciej Warszawski says:


You are trying to set a property of an object to null, which is
different than setting the variable (object container) to null
(Nothing).

It sounds like the object doesn't allow null as a value for that
property.


----------
Randy Hunt
MCP+I / MCSE

visit www.wshscripting.com

Richard A. Lowe

unread,
Feb 28, 2001, 11:28:09 PM2/28/01
to
I ran into this about 5 months ago... found 3 possible solutions, below.
Yes, behind the scenes these two are not the same. Nothing is variant type
VT_DISPATCH and null is VT_EMPTY. In order to disconnect a recordset in
JScript you need one of these three solutions:

1) Include some VBScript function that returns Nothing:
<%
Function getNothing()
Set getNothing = Nothing
End Function %>

2) Use an MS developer's personal utility:
http://www.netspace.net.au/~torrboy/code/jargutil/

3) My solution: simply get a reference to the default value for an unopened
recordset, which just happens to be Nothing (VT_DISPATCH):

//---- Custom 'Nothing' equivalent for disconnected recordsets ----
var oRS = Server.CreateObject('ADODB.Recordset');
var Nothing = oRS.ActiveConnection;
var oRS = Nothing;

Regards,
Richard


"Maciej Warszawski" <maciej_w...@idg.com.pl> wrote in message
news:OnG$SVfoAHA.1384@tkmsftngp02...

Maciej Warszawski

unread,
Feb 28, 2001, 11:45:58 PM2/28/01
to
Thank you very much, that was very smart, I'm impressed

Greets
MW

"Richard A. Lowe" <cha...@YUMSPAMYUMyahoo.com> wrote in message
news:#T9kWfgoAHA.1840@tkmsftngp03...

PlaneDoc

unread,
Mar 1, 2001, 9:57:27 PM3/1/01
to

I've followed this thread with interest, but I'm confused.

Why not just do:

rs.Close()
rs = null

I always thought this was the way to clean up a recordset in Jscript.
Have I been "doing it wrong" all this time?

Randy

Richard A. Lowe

unread,
Mar 2, 2001, 7:06:37 AM3/2/01
to
No, you're doing it right.... he was referring to disconnection a recordset
from a datasource:

objRS.ActiveConnection = null; // DOSEN'T WORK

You have to use the methods I've described to disconnect a recordset in
JScript.

(Note that in .NET this isn't supposed to be a prob :)
Richard

"PlaneDoc" <plan...@bizdistrict.com_nospam> wrote in message
news:c03u9tccmjs0m1ujv...@4ax.com...

PlaneDoc

unread,
Mar 2, 2001, 10:33:46 AM3/2/01
to

On Fri, 2 Mar 2001 06:06:37 -0600, "Richard A. Lowe"
<cha...@YUMSPAMYUMyahoo.com> wrote:

>No, you're doing it right.... he was referring to disconnection a recordset
>from a datasource:
>
>objRS.ActiveConnection = null; // DOSEN'T WORK


Doh! I see that now. Oh well, it had been a long day yesterday...


>
>You have to use the methods I've described to disconnect a recordset in
>JScript.
>
>(Note that in .NET this isn't supposed to be a prob :)

Right, since we will all be using ADO.NET and C# <grin>

>Richard
>

0 new messages