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.
>