|
 |
asp_databases thread: DSN-less Connection to an Access database
Message #1 by "Marcia A. Eaton" <msweet@n...> on Mon, 20 Aug 2001 18:30:17
|
|
Good afternoon,
Can anyone help me with some syntax.... Normally, I set up DSN's on the
server, and then reference the DSN in my application.... But I understand
you can connect to the database directly via the application.
Can someone give me the syntax to connect to an Access database without
using a DSN....
To do it with a DSN, I think it's
oConn.Open "DSN=myDB1; UserId=abcdef; pwd=ghijk"
But I would need to specify the access driver....
Thanks in advance for the help,
Marcia
Message #2 by "Philip Tham" <philipt1@h...> on Mon, 20 Aug 2001 13:16:19 -0500
|
|
Try this syntax Marcia,
set conn = server.createobject ("adodb.connection")
conn.Open "PROVIDER=MSDASQL;" & _
"DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=e:\InetPub\Clients\DBDemo.mdb"
Regards,
Philip
----- Original Message -----
From: "Marcia A. Eaton" <msweet@n...>
To: "ASP Databases" <asp_databases@p...>
Sent: Monday, August 20, 2001 6:30 PM
Subject: [asp_databases] DSN-less Connection to an Access database
> Good afternoon,
>
> Can anyone help me with some syntax.... Normally, I set up DSN's on the
> server, and then reference the DSN in my application.... But I understand
> you can connect to the database directly via the application.
>
> Can someone give me the syntax to connect to an Access database without
> using a DSN....
>
> To do it with a DSN, I think it's
>
> oConn.Open "DSN=myDB1; UserId=abcdef; pwd=ghijk"
>
> But I would need to specify the access driver....
>
> Thanks in advance for the help,
>
> Marcia
Message #3 by Alan.Angelone@u... on Mon, 20 Aug 2001 14:16:39 -0400
|
|
Enter the information below changing the source to your database
<%
dim cn
dim cnstr
set cn =3D server.createobject("ADODB.connection")
cnstr =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;Data
Source=3Dc:\dbase\helpdesk2.mdb"
cn.connectionstring =3D cnstr
cn.open cnstr
%>
Good luck
Alan Angelone
Pager: xxx-xxx-xxxx
Phone: xxx-xxx-xxxx
Email:
8775684922@s...
alan.angelone@u...
-----Original Message-----
From: Marcia A. Eaton [mailto:msweet@n...]
Sent: Monday, August 20, 2001 2:30 PM
To: ASP Databases
Subject: [asp_databases] DSN-less Connection to an Access database
Good afternoon,
Can anyone help me with some syntax.... Normally, I set up DSN's on
the
server, and then reference the DSN in my application.... But I
understand
you can connect to the database directly via the application.
Can someone give me the syntax to connect to an Access database without
using a DSN....
To do it with a DSN, I think it's
oConn.Open "DSN=3DmyDB1; UserId=3Dabcdef; pwd=3Dghijk"
But I would need to specify the access driver....
Thanks in advance for the help,
Marcia
Message #4 by "Curtis F. Barnett" <cfb@s...> on Mon, 20 Aug 2001 13:26:41 -0500
|
|
Marcia
The DSN-Less connection which works for me is:
<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
<% Response.Buffer=true %>
<!-- #INCLUDE FILE="adovbs.inc" -->
...
<%
Dim filePath
Dim objConn
filePath = Server.MapPath("/sub-directory/database")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
...
%>
Good Luck....
Curtis F. Barnett
SailorSoft.com
Be sure you have a copy of ADOVBS.INC in your root. On an NT4.0 box it is in
"C:\Program Files\Common Files\System\ado"
> -----Original Message-----
> From: Marcia A. Eaton [mailto:msweet@n...]
> Sent: Monday, August 20, 2001 1:30 PM
> To: ASP Databases
> Subject: [asp_databases] DSN-less Connection to an Access database
>
>
> Good afternoon,
>
> Can anyone help me with some syntax.... Normally, I set up DSN's on the
> server, and then reference the DSN in my application.... But I
> understand
> you can connect to the database directly via the application.
>
> Can someone give me the syntax to connect to an Access database without
> using a DSN....
>
> To do it with a DSN, I think it's
>
> oConn.Open "DSN=myDB1; UserId=abcdef; pwd=ghijk"
>
> But I would need to specify the access driver....
>
> Thanks in advance for the help,
>
> Marcia
|
|
 |