OLE DB Connection Problems

L

Laphan

Hi Guys

One of you kindly confirmed what the true OLE DB syntax is for an ASP > ADO
Access DB with password, but I'm struggling to parse this in my ASP page.

FYR, I have it as follows:

strDSN="""Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("mydb.mdb") & ";Jet OLEDB:Database
Password=kitkat"",""admin"","""""

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Mode = 3
oConn.Connectionstring = strDSN
oConn.Open

But when I execute the above I get:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name too long

The path name for the DB is spot on, as it works with the ODBC variant, but
I think it has something to do with my 200 quote marks!

Can u help??

Rgds

Laphan
 
J

John Blessing

Laphan said:
Hi Guys

One of you kindly confirmed what the true OLE DB syntax is for an ASP > ADO
Access DB with password, but I'm struggling to parse this in my ASP
page.

FYR, I have it as follows:

strDSN="""Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("mydb.mdb") & ";Jet OLEDB:Database
Password=kitkat"",""admin"","""""

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Mode = 3
oConn.Connectionstring = strDSN
oConn.Open

But when I execute the above I get:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name too long

The path name for the DB is spot on, as it works with the ODBC variant, but
I think it has something to do with my 200 quote marks!

Can u help??

Rgds

Laphan


Get rid of the quotes, you don't need them.

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.free-helpdesk.com - Completely free help desk software !
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook
 
R

Robbie

John Blessing said:
Laphan said:
Hi Guys

One of you kindly confirmed what the true OLE DB syntax is for an ASP > ADO
Access DB with password, but I'm struggling to parse this in my ASP
page.

FYR, I have it as follows:

strDSN="""Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("mydb.mdb") & ";Jet OLEDB:Database
Password=kitkat"",""admin"","""""

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Mode = 3
oConn.Connectionstring = strDSN
oConn.Open

But when I execute the above I get:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name too long

The path name for the DB is spot on, as it works with the ODBC variant, but
I think it has something to do with my 200 quote marks!

Can u help??

Rgds

Laphan


Get rid of the quotes, you don't need them.

Hi John

Thanks for your prompt assistance.

As per your suggestion, I changed it to the following:

strDSN="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("mydb.mdb") & ";Jet OLEDB:Database
Password=kitkat,admin,"

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Mode = 3
oConn.Connectionstring = strDSN
oConn.Open

But now I get the following error message:

Microsoft JET Database Engine error '80040e4d'
Not a valid password.

If I change the strDSN back to:

strDSN="DBQ=" & Server.Mappath("mydb.mdb") & ";Driver={Microsoft
Access Driver (*.mdb)}; userID=Admin; pwd=kitkat"

It works fine.

I want to use OLEDB so what am I doing wrong??

Rgds

Laphan
 
B

Bob Barrows

www.able-consulting.com/ado_conn.htm

more below
As per your suggestion, I changed it to the following:

strDSN="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("mydb.mdb") & ";Jet OLEDB:Database
Password=kitkat,admin,"

How could this possibly work? I assume the password is "kitkat", not
"kitkat,admin".

Unless you have a workgroup-secured database, you do NOT need to supply a
user name. You only need to supply a password if the database is
password-protected.

Bob Barrows
 
R

Robbie

Bob Barrows said:
www.able-consulting.com/ado_conn.htm

more below


How could this possibly work? I assume the password is "kitkat", not
"kitkat,admin".

Unless you have a workgroup-secured database, you do NOT need to supply a
user name. You only need to supply a password if the database is
password-protected.

Bob Barrows

Dear Bob

Thanks for your reply.

John (the other poster) kindly sent me some MS stuff on this so I
copied and used the following:

strDSN="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.Mappath("mydb.mdb") & ";Jet OLEDB:Database Password=kitkat"

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Connectionstring = strDSN
oConn.Open

However when I run this I get the following error message:

Microsoft JET Database Engine error '80040e14'
Syntax error in parameters clause. Make sure the parameter exists and
that you typed its value correctly.

If I use the above path and password in a normal ODBC connection it
works fine.

Can u tell what I am doing wrong?

Rgds

Robbie
 
B

Bob Barrows

Robbie said:
John (the other poster) kindly sent me some MS stuff on this so I
copied and used the following:

strDSN="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.Mappath("mydb.mdb") & ";Jet OLEDB:Database Password=kitkat"

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Connectionstring = strDSN
oConn.Open

However when I run this I get the following error message:

Microsoft JET Database Engine error '80040e14'
Syntax error in parameters clause. Make sure the parameter exists and
that you typed its value correctly.

If I use the above path and password in a normal ODBC connection it
works fine.
This error has nothing to do with your connection. The connection has been
established: otherwise you would not be getting an error from the JET
Database Engine. It's a problem with something you are doing later on in the
code. Why don't you show us the relevant code?

"Parameters clause" sounds like a problem in a query. You're not using any
reserved words as column or parameter names are you? See here for a list of
reserved words:
http://www.aspfaq.com/show.asp?id=2080

If you have made the mistake of using a reserved word, then change the name
of the column or parameter. If you absolutely cannot change the name, then
you need to surround it with brackets [] in order to use it in a query
called from ADO.

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,117
Latest member
Matilda564
Top