Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 7th, 2006, 07:11 AM
Registered User
 
Join Date: Dec 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kumar_siva
Default problem Accessing Access Database using JavaScript

i am not able to retrive the data from the web server using the below mentioned javascript. I got the web server path by using the asp function Server.MapPath() and i am able to retrive the data using asp. but i have to use javascript so pls help me and tell me where i am wrong..........

function GetDBMake()
    {
        var objCN = new ActiveXObject("ADODB.Connection");
        var objRS = new ActiveXObject("ADODB.Recordset");
        var strRet = "";
        objCN.open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Inetpub\mebco.com\mebco.mdb;Persist Security Info=False")
        objRS.open("Select distinct make From Battery_Names", objCN, 0, 1)

        while(!objRS.EOF)
        {
            strRet = strRet + ';' + objRS.Fields("make");
            objRS.MoveNext()
        }

        objRS.close
        objCN.close
        return strRet;
    }

!!! kumar !!!
 
Old February 7th, 2006, 03:00 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think in JavaScript you should escape the backslash with another backslash:


objCN.open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Inetpub\\mebco.com\\mebco.mdb;Persist Security Info=False")


HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: All the answers by Ilse De Lange (Track 13 from the album: Here I Am - 1998-2003) What's This?
 
Old February 8th, 2006, 07:25 AM
Registered User
 
Join Date: Dec 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kumar_siva
Default

hi imar,
   i tried ur code its working in our LAN, but its not working in Web Server, even it not displaying any error msgs.

thank u
kumar
 
Old February 8th, 2006, 01:45 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Where is the code running, client-side or server-side? This code needs to run on the same machine as the database so server-side is more practical, if client-side it will only work when the script is run on the same machine as the database and if it's a web page then when security settings are very low.



--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing data from Database using Javascript shibasish_nandi Javascript How-To 1 July 30th, 2008 01:45 PM
asp.net 2 accessing sql database code problem... minstrel ASP.NET 2.0 Basics 1 August 31st, 2006 11:40 PM
Problem accessing Access Database using JavaScript kumar_siva Javascript 0 February 7th, 2006 07:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.