|
-
May 1st, 2002, 09:38 AM
#1
Thread Starter
Lively Member
Declaring ADO objects on server-side javascript
Hi,
I'm doing some date calculations in an asp page and, since vbs doesn't really do the job, I'm working with server-side javascript instead.
Now, in this same server-side javascript, I would like to access our SQL Server databases using ADO. I'm looking for the javascript equivalent of declaring the different objects (connection, command and record set for instance).
Anyone has a clue?
Thanx!
Vive le fromage! 
Windows 2000 SP2 (office)
WinXP PRO (home)
-
May 1st, 2002, 09:42 AM
#2
Addicted Member
By my knowledge,
JavaScript is only Client-side programming.
-
May 1st, 2002, 09:44 AM
#3
Thread Starter
Lively Member
Allow me to add to your knowledge...
javascript is also server-side programming
Vive le fromage! 
Windows 2000 SP2 (office)
WinXP PRO (home)
-
May 1st, 2002, 09:45 AM
#4
Addicted Member
Thanks
i never used it but it's a good thing to know.
-
May 1st, 2002, 09:54 AM
#5
Frenzied Member
Yes, if your server is set up for it, you can do server-side JavaScript. I'm not sure if or how to get it to work with IIS or Apache (if at all). And I have no idea how you would access ADO. I've never known anyone to use server-side JavaScript, but authoritative documentation can found at Netscape.
If you are writing an ASP, then you are not using JavaScript, you are using JScript. Check MSDN for how to access ADO via JScript. I imagine the syntax is not much different than if you were using VBScript in your ASP.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
May 1st, 2002, 10:00 AM
#6
Thread Starter
Lively Member
Thanx CiberTHuG, you gave me an insight that helped me out finding what I was looking for.
In fact, don't ask me why I haven't tried it before asking here, but the syntax is just about the same as for VBS; that is:
var cnnIntranet = Server.CreateObject("ADODB.Connection")
Dummy me...
Thanx anyways!
Vive le fromage! 
Windows 2000 SP2 (office)
WinXP PRO (home)
-
May 1st, 2002, 01:35 PM
#7
Black Cat
Originally posted by CiberTHuG
If you are writing an ASP, then you are not using JavaScript, you are using JScript. Check MSDN for how to access ADO via JScript. I imagine the syntax is not much different than if you were using VBScript in your ASP.
The ASP objects are the same, but the syntax is completely different from VBScript - for all intents and purposes, it would be very hard to tell javascript from Jscript without being specifally told (or see the ASP objects and know).
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
May 1st, 2002, 02:19 PM
#8
Frenzied Member
Originally posted by JoshT
The ASP objects are the same, but the syntax is completely different from VBScript - for all intents and purposes, it would be very hard to tell javascript from Jscript without being specifally told (or see the ASP objects and know).
I agree that it is hard to tell JScript from JavaScript (which was the point behind JScript), but I would imagine the difference is important, since I don't know if you can access ActiveX DLL with JavaScript, but I know you can with JScript (in an ASP).
As to the syntax being different from VBScript in an ASP, even the PerlScript syntax is the same.
Code:
<% @Language="VBScript" %>
<%
Dim adodbConn
Set adodbConn = Server.CreateObject("ADODB.Connection")
%>
Code:
<% @Language="PerlScript" %>
<%
my $adodbConn = Server->CreateObject("ADODB.Connection");
%>
Honestly, it has been a while since I've had the luxury of using PerlScript, but I think I remembered the syntax correctly. In these two cases, you do the same thing the same way because the ASP objects are meant to be somewhat universal. But there are some changes to each to the specific centricities of each language.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
May 2nd, 2002, 10:43 AM
#9
Black Cat
I have to disagee with you, Travis. The Object Models are the same, but the actually language syntax is radically different.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
May 2nd, 2002, 10:51 AM
#10
Frenzied Member
POtato/poTAHto
I think the language differences are centricities of the languages, but since the object model is the same if you know the object model, then the syntax is the same (just centric . instead of ->).
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|