faqts : Computers : Programming : Languages : JavaScript : Database

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

161 of 227 people (71%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

Can I Access a Microsoft Access database using JavaScript?

May 3rd, 2001 08:50
TanTrung LeTran, Chris Durkin, Jeroen Ritmeijer, Spy, Ryan Buterbaugh, Stefan Kyrytow, Knud van Eeden,


Using internet Explorer it is perfectly possible to access an MS-Access 
database from within Client side script (very similar to the ASP server 
side code). The only thing you have to take into account is to make 
sure that ADO is available on the client as well as the proper IE 
security settings.
--Jeroen Ritmeijer
Note that this will only work in IE and so is appropriate only for 
Intranet pages. For a cross browser, cross platform solution, you need 
to use server side scripting, such as ASP. See the ASP FAQTS kb for 
details.
--Chris Durkin
I can imagine that you were actually asking whether one can access MS 
Access on server side using Javascript (instead of using VBScript, for 
example). The answer is Yes. There are even some advantages to use 
Javascript on IIS4 or older (e.g., regular expression). A code example:
<%  @LANGUAGE="JScript" %>
<% 
var strConnect = "DSN=YourDSNHere";
oConn=Server.CreateObject("ADODB.Connection");
oConn.Open(strConnect);
var strSQL = "SELECT SomeField FROM myTable;";
var rsAd=oConn.Execute(strSQL);
Response.Write("First row is "+ rsAd.Fields("SomeField") )
oConn.Close();
%>
Good luck :)
--TanTrung LeTran.