I am new to ASP, and I used to write the connection for my Access Database using DNSLESS Connection like this:

<HTML>
<BODY>
<%
'Actionvar=Request.QueryString("actionvar")
'** Set Up a DSNLESS CONNECTION<BR>
Set conn = server.createobject("adodb.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
'DSNtemp=dsntemp & "DBQ=" & server.mappath("Record.mdb")
DSNtemp=dsntemp & "DBQ=" & server.mappath("MyWeb/MyRecord/Record.mdb")
conn.Open DSNtemp
%>

</BODY>
</HTML>


My question is:

1.Here, Record.mdb is kept inside my web Folder. If the Data have a password, then how shall I write the Connection String.

2. Is it possible to Connect MySql using ASP, if so, what is the Connection String.

If any one can solved my simple problem, I shall be very glad.

Hi, you can use Jet 4.0 to connect to Access
:

Set conn = server.createobject("adodb.connection")
DSNTEMP = "provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "\Record.mdb; Jet OLEDB:Database Password=yourpasswordhere"

For MySQL:

Set conn = server.createobject("adodb.connection")
DSNTEMP = "driver={MySQL ODBC 3.51 Driver};Server=10.10.10.1;User=USERNAME;Password=PASSWORD;Database=DB_NAME"

I think this should help.

Thank to all who reply my problem, but unfortunately the connection which you suggested is not working using this (For MSAccess with Password, using DSNLess Connection):

Set conn = server.createobject("adodb.connection")
DSNTEMP = "provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "\Record.mdb; Jet OLEDB:Database Password=yourpasswordhere"

The Connection for MS Access without Passwword which I am using is:


Set conn = server.createobject("adodb.connection")

DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("MyWeb/MyRecord/Record.mdb")
conn.Open DSNtemp

The above is working properly.


Can any one give me the correct Connection for Access with ASP with Password.

I think the problem is with App.Path which, AFAIK, is not supported in ASP. It works in VB.
If the path to your database is fixed, use

Set conn = server.createobject("adodb.connection")
DSNTEMP = "provider=Microsoft.Jet.OLEDB.4.0;data source= << Full path to your database>>\Record.mdb; Jet OLEDB:Database Password=yourpasswordhere"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.