|
I am trying to connect to an MS access database which is on the ISP. The connection path I am using is
var dbPath = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + Server.MapPath("mydatabase.mdb");
This is not working any suggestions???????
|
|
|
Server.MapPath is a method of the ASP "Server" object. You don`t do this in Javascript. Also, you don`t usually open database with JavaScript. This would usually be done server-side using VBScript in an ASP page or VB.Net or C# in an ASP.Net page. I can help you get started with this...the hardest thing for me to learn when I first started ASP and data-driven web pages was HOW IN THE HECK do I open and interact with the database! I understand! You will get there.
|
|
|
|
|
I am with the same problem.
I can not connect MS Access thru Javascript.
Have you already solve the problem or anybody have a solution?
Thank you
|
|
|
The original poster did not reply. Are you two trying to use Javascript to create server-side ASP scripts? Or are you trying to access the database using client-side javascript in your HTML page?
If using ASP, why use Javascript? You CAN, but the standard is to use VBScript, and you`ll find lots of code examples for VBScript.
If you mean client-side javascript in the HTML, unless I`m mistaken, this is not possible. You cannot access the database that lives on another computer from script in your client`s browser. You can read and write local files on the client`s computer, but most browsers will by default block this kind of activity for security purposes.
|
|
|
|
|
Javascript is executed on the client, but the client isn`t running a database. How would the connection ever be made?
The database is running on the SERVER which means you`ll need to open a connection to it using a SERVER SIDE script- VBScript being a perfect choice.
|
|
|
Agreed, Kentium. This is what I`m trying to help these guys understand. Now, technically, you can use Javascript in your ASP code server-side, but why? If you have a server that can process ASP, then you have VBScript available to you, and this is the defacto standard for ASP scripting.
You guys see what Kentium and I are saying? You can`t open your database from the client`s web-browser. You open the database from code on your webserver. Your server-side code process the data and generates an HTML page that is sent to the client`s browser. The browser is never directly accessing the database.
|
|
|
|
|
Thanks guys for your help
I am not using ASP. I was using javascript to read from the database and then generate the html. this works OK on a server & client network, as I can put the drive number in the path, but i cannot do this web.....
I will get around this using XML/XSL
thanks
|
|
|