PDA

Click to See Complete Forum and Search --> : About Open Database nd Recordset


Wen Lie
May 26th, 2000, 11:48 AM
Hi hi again Guys...

Now, I'm confuse about opening connection and recordset.
I have a database in Access, named "MyWebDb.Mdb" and the password to open it is "Will"

I'm trying several ways... Here they are :

1st way : From Mark Sreeves
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("\MyWebDB.mdb"))
The question for this is : How should I put the Password ???


2nd way : Using Microsoft Jet OLEDB 4.0
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";Password=Will;"

The question is :
My open statement above doesn't work out.

The error occured is :
Microsoft JET Database Engine error '80040e4d'

Cannot start your application. The workgroup information file is missing or opened exclusively by another user.

/Login.asp, line 19

But, if I eliminate the password at myWebDB.Mdb, and remove the password at Conn.Open statement, like below :

Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"

My ASP page will start / run.

The question is why ???


And how can I open it, if I want to use password on my Database ???

BRgds,
Wen Lie

[Edited by Wen Lie on 05-27-2000 at 12:49 AM]

May 27th, 2000, 06:20 PM
That puzled me at first too but with a little help from my friends (well t'was "Beginning ASP Databases" from WROX actually...not trying to plug them or anything but I've found it really useful. :) )

Ok...

dim oConn
set oConn = Server.CreateObject("ADODB.Connection")

oConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};"
oConn.ConnectionString = oConn.ConnectionString & "DBQ=" & Server.MapPath("\MyWebDB.mdb") & ";"
oConn.ConnectionString = oConn.ConnectionString & "PWD=Will"
oConn.Open

How's that sound? Works for me...
You can then use something like:

Dim oRS
Set oRS = Server.CreateObject("ADODB.Recordset")
oRS.Open TABLENAME/SQL STATEMENT, oConn

Wen Lie
May 28th, 2000, 10:04 AM
Thx, but, how about if I want to open it using Microsoft Jet OLEDB 4.0 ???

Wen Lie...

May 28th, 2000, 05:37 PM
I think:

oConn.ConnectionString = "Provider=Microsoft.Jet.4.00; "
oConn.ConnectionString = oConn.ConnectionString & "Data Source=" & Server.MapPath("\MyWebDB.mdb") & "; "
oConn.ConnectionString = oConn.ConnectionString & "pwd=Will"

Haven't had chance to test that but I think it's about right :) You may need to use "Password=Will" instead of "pwd=Will".