Is it possible to connect to a MS Access (Mdb) database file from a html
page and write some records in the html file using Document.Write(myRec)
etc. The db file will be located in the same folder as the html file. Lets
say the database is a Telephonelist and I want to be able to read it from a
html page located in a shared folder. I suppose you would use ADO and SQL?

A very short example would be very much appriciated. Thank you so much in
advance.

Sincerely
Jan

PS. I know a little ASP but that is not an option here. Security is not
important in this case.

Re: Connect to db via VBScript? by de

de
Mon Mar 13 17:35:26 CST 2006

Replace filename,username,password,tablename,fieldname as appropriate for
you. You can also use
rec(0),rec(1), etc instead but this is not recommended.

set con = CreateObject("ADODB.Connection")

con.Open "Driver={Microsoft Access Driver
(*.mdb)};Dbq=filename;Uid=username;Pwd=password;"
set rec = con.Execute("select * from tablename")

do until rec.EOF
wscript.Echo rec("fieldname"),rec("fieldname)...
rec.MoveNext
loop

rec.Close
con.Close

I used wscript.Echo. You can replace this with an appropriate document.write
statement.

"Jan G. Thorstensen" <post@infosupport.no> wrote in message
news:uzEuqxuRGHA.424@TK2MSFTNGP12.phx.gbl...
> Is it possible to connect to a MS Access (Mdb) database file from a html
> page and write some records in the html file using Document.Write(myRec)
> etc. The db file will be located in the same folder as the html file. Lets
> say the database is a Telephonelist and I want to be able to read it from
> a html page located in a shared folder. I suppose you would use ADO and
> SQL?
>
> A very short example would be very much appriciated. Thank you so much in
> advance.
>
> Sincerely
> Jan
>
> PS. I know a little ASP but that is not an option here. Security is not
> important in this case.
>



Re: Connect to db via VBScript? by Bob

Bob
Tue Mar 14 07:18:10 CST 2006

Jan G. Thorstensen wrote:
> Is it possible to connect to a MS Access (Mdb) database file from a
> html page and write some records in the html file using
> Document.Write(myRec) etc. The db file will be located in the same
> folder as the html file. Lets say the database is a Telephonelist and
> I want to be able to read it from a html page located in a shared
> folder. I suppose you would use ADO and SQL?
>
Probably not, due to security issues. The browser will not have access to
the local file system unless you use an HTA (HyperText Application). Google
should get you plenty of examples for using this.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.