[quoted text, click to view] "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:OE5c6XLKGHA.1676@TK2MSFTNGP09.phx.gbl...
> Roland Hall wrote:
>>
>> My error is on this line:
>>
>> comm.ActiveConnection = conn.Open()
>>
>> ADODB.Command error '800a0bb9'
>> Arguments are of the wrong type, are out of acceptable range, or are
>> in conflict with one another.
>>
The method connection.Open does not return a connection object,
(typeof(conn.Open()) == "undefined") is a true expression. So it's the
assignment of that to ActiveConnection that's the rub.
[quoted text, click to view] > I'm not going to test it, but why wouldn't you do:
> conn.Open();
> comm.ActiveConnection=conn;
>
> Actually, I think the problem may be due to the lack of optional arguments
> in jscript: you have to supply all 4 arguments to the Open method.
JScript does not lack optional arguments, it just lacks syntax that allows
ommission of one argument with inclusion of another that's later in the
list. So if you want to omit an argument, you must be prepared to omit all
that come after it in the arguments list as well.
Functions in JScript implicitly have a variable length argument list -- in
fact, declared arguments are (besides the fact that they make the code much
easier to read) really more of a formality than anything else, thanks to the
JScript function object's arguments property. Here's an example:
// Accepts a variable number of arguments; returns the value of the
// first argument in its list that is neither null nor an empty string
//
function coalesce()
{
var i;
for (i = 0; i < arguments.length; i++)
{
if ((arguments[i] != null) && (arguments[i] != ""))
return arguments[i];
}
return "";
}
[from one of Bob's earlier posts]
[quoted text, click to view] > Hah! It does work in jscript!
Why wouldn't it? :-) I *am* a fan of server-side JScript, because its
exception handling construct is more flexible and capable than is its
counterpart in VBS. I've also found it to perform better in some cases (and
haven't noticed any where it performed worse -- which is not to say there
are none, nor even that I have never encountered any, just that none have
drawn my attention.)
The only thing I missed about VBS is that VBS' built-in functions tend to be
a little more intuitive/easier to use... so I coded work-alikes for the ones
I use heavily... but to each his own. :-)
My 2 cents,
Mark
[quoted text, click to view] > connection.Open ConnectionString, UserID, Password, Options
>
> So, it should probably look like:
> conn.Open("","","",null)
>
> or, maybe:
> conn.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=c:\\databases\\ado.mdb","","",null)
>
> Does your stored procedure have output parameter(s)? Or are you going to
> read the Return parameter value? If not, I wonder if the
> procedure-as-connection-method technique would work in jscript ... ?
>
> Bob Barrows
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>