Results 1 to 10 of 10

Thread: Declaring ADO objects on server-side javascript

  1. #1

    Thread Starter
    Lively Member HiKsFiles's Avatar
    Join Date
    Jul 2001
    Location
    Ste-Foy, Québec, Canada (Yeah, I know ... way up north!!!)
    Posts
    71

    Question 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)

  2. #2
    Addicted Member
    Join Date
    Oct 2001
    Posts
    150
    By my knowledge,

    JavaScript is only Client-side programming.

  3. #3

    Thread Starter
    Lively Member HiKsFiles's Avatar
    Join Date
    Jul 2001
    Location
    Ste-Foy, Québec, Canada (Yeah, I know ... way up north!!!)
    Posts
    71
    Allow me to add to your knowledge...

    javascript is also server-side programming
    Vive le fromage!
    Windows 2000 SP2 (office)
    WinXP PRO (home)

  4. #4
    Addicted Member
    Join Date
    Oct 2001
    Posts
    150
    Thanks

    i never used it but it's a good thing to know.

  5. #5
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    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.

  6. #6

    Thread Starter
    Lively Member HiKsFiles's Avatar
    Join Date
    Jul 2001
    Location
    Ste-Foy, Québec, Canada (Yeah, I know ... way up north!!!)
    Posts
    71
    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)

  7. #7
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    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.

  8. #8
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    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.

  9. #9
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    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.

  10. #10
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    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
  •  



Click Here to Expand Forum to Full Width