Discussion:
Error Using Server.CreateObject
(too old to reply)
Jim F
19 years ago
Permalink
When I use the following line of code:

var cn = new Server.CreateObject("ADODB.Connection");

I get the following error:

'Server' is undefined.

I new to jscript, so I've probably left something out some where but
whatever it is I 've not seen it in any of the examples I've copied. Any
suggestions anyone?
--
Jim F
Jayme Pechan
19 years ago
Permalink
If this is javascript it should be...

var cn = new ActiveXObject("ADODB.Connection");

Jayme Pechan
Whitefeld
Post by Jim F
var cn = new Server.CreateObject("ADODB.Connection");
'Server' is undefined.
I new to jscript, so I've probably left something out some where but
whatever it is I 've not seen it in any of the examples I've copied. Any
suggestions anyone?
--
Jim F
Jim F
19 years ago
Permalink
Thanks, for the info. I have successfully tested it.
--
Jim F
Post by Jayme Pechan
If this is javascript it should be...
var cn = new ActiveXObject("ADODB.Connection");
Jayme Pechan
Whitefeld
Post by Jim F
var cn = new Server.CreateObject("ADODB.Connection");
'Server' is undefined.
I new to jscript, so I've probably left something out some where but
whatever it is I 've not seen it in any of the examples I've copied. Any
suggestions anyone?
--
Jim F
Dave Anderson
19 years ago
Permalink
Post by Jim F
var cn = new Server.CreateObject("ADODB.Connection");
'Server' is undefined.
If this were server-side ASP, it would almost be correct. Lose the "new":

<%@Language=JScript%><%

var cn = Server.CreateObject("ADODB.Connection")

%>
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Continue reading on narkive:
Loading...