Trouble is it may be a VB constant?

G

George Hester

I have this at the top of an ASP page:

<!--METADATA TYPE="TypeLib" NAME="Microsoft ActiveX Data Objects 2.6 Library" UUID="{00000206-0000-0010-8000-00AA006D2EA4}" VERSION="2.6"-->

This is so I can use the enums say for CommandType. I haven't finished the page but I'm wondering about those constants for example adCmdTable which is 2. But a 2 in VBScript is different then a 2 in JavaScript I think.

I have this:

<script runat="server" type="text/javascript" language="JavaScript">
// I know - I need the language attribute above also
//...
var cmdTmp = Server.CreateObject('ADODB.Command');
cmdTmp.CommandType = 2;
//...
</script>

but I would prefer to have this:

cmdTmp.CommandType = adCmdTable;

but I'm not sure if adCmdTable will make sense in JavaScript or am I just making a mountain out of a mole hill?
Should I do something like this if not?

var adCmdTable = <%=adCmdTable%>;
Thanks.
 
D

Douglas J. Steele

The constants are used by ADO, not by VBScript or JavaScript. But a 2 should
be a 2, regardless of what technology you're using!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I have this at the top of an ASP page:

<!--METADATA TYPE="TypeLib" NAME="Microsoft ActiveX Data Objects 2.6
Library" UUID="{00000206-0000-0010-8000-00AA006D2EA4}" VERSION="2.6"-->

This is so I can use the enums say for CommandType. I haven't finished the
page but I'm wondering about those constants for example adCmdTable which is
2. But a 2 in VBScript is different then a 2 in JavaScript I think.

I have this:

<script runat="server" type="text/javascript" language="JavaScript">
// I know - I need the language attribute above also
//...
var cmdTmp = Server.CreateObject('ADODB.Command');
cmdTmp.CommandType = 2;
//...
</script>

but I would prefer to have this:

cmdTmp.CommandType = adCmdTable;

but I'm not sure if adCmdTable will make sense in JavaScript or am I just
making a mountain out of a mole hill?
Should I do something like this if not?

var adCmdTable = <%=adCmdTable%>;
Thanks.
 
B

Brendan Reynolds

I believe this is usually handled using the include file "adovbs.inc", but
you might get a more definite answer in an ASP newsgroup.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


I have this at the top of an ASP page:

<!--METADATA TYPE="TypeLib" NAME="Microsoft ActiveX Data Objects 2.6
Library" UUID="{00000206-0000-0010-8000-00AA006D2EA4}" VERSION="2.6"-->

This is so I can use the enums say for CommandType. I haven't finished the
page but I'm wondering about those constants for example adCmdTable which is
2. But a 2 in VBScript is different then a 2 in JavaScript I think.

I have this:

<script runat="server" type="text/javascript" language="JavaScript">
// I know - I need the language attribute above also
//...
var cmdTmp = Server.CreateObject('ADODB.Command');
cmdTmp.CommandType = 2;
//...
</script>

but I would prefer to have this:

cmdTmp.CommandType = adCmdTable;

but I'm not sure if adCmdTable will make sense in JavaScript or am I just
making a mountain out of a mole hill?
Should I do something like this if not?

var adCmdTable = <%=adCmdTable%>;
Thanks.
 
G

George Hester

Actually a 2 in JavaScript is quite different then a 2 in VBScript. I think you are right in some sense but I think the ADO constant depends on this in the ASP:

<%@language="VBScript"%>

I checked it. It doesn't work - as I thought. I could either do this:

<%@language="JavaScript"%>

or when I use adCmdTable with "VBScript" above do this:

var adCmdTable = <%=adCmdTable%>;
 
Top