Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    austin, Texas, USA
    Thanked 0 Times in 0 Posts

    jascript db connection

    Googling gives me a lot of hits on discussion boards which can be hard to follow. perhaps the loungers can give me something pithy?

    I am working on a search engine and want to execute a quick recordcount on submit to check for queries that will return 1000+ records in order to make sure the user really wants that. I figure do this in Javascript plus the Confirm style alert box. problem is, i've never used javascript to connect to a db. does anyone have a quick and dirty script example? this is for SQL Server over TCP/IP.

    TIA <img src=/S/compute.gif border=0 alt=compute width=40 height=20>

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: jascript db connection

    It's similar to VBScript except that you have to use JavaScript syntax and you create the object a bit differently. You go from something like this in an ASP page:

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

    to something like this in a client-side JavaScript page in Internet Explorer:

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

    That said, you probably should expect irritating security prompts and miserable performance, unless all the work is being done in stored procedures on the server and you are retrieving only tiny recordsets.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts