Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_database_setup thread: DSNless connections


Message #1 by "Sara Petty" <spetty@w...> on Thu, 1 Feb 2001 15:58:19 -0000
I am trying to create an ASP page that will list the current continuing

education classes that we are holding.  I would like to create a DSNless

connection to my database, but I do not know the physical location of the

web root on the server where my web site is.  I tried the following code,

but it just tells me that it can't find the file.



<%

  Dim oConn

  Dim oRSit

  

  Set oConn=Server.CreateObject ("ADODB.Connection")

  Set oRSit=Server.CreateObject ("ADODB.Recordset")

  oConn.ConnectionString="driver={Microsoft Access Driver (*.mdb)};DBQ=" &

server.mappath("PD.mdb")

  oConn.Open

  

  oRSit.Open "COURSEsubtable", oConn

  oRSit.MoveFirst

%>



My database is located in the fpdb folder of my web.  Perhaps I am not

being specific enough for the location of my database.  Can anyone help?

Message #2 by Imar Spaanjaars <Imar@S...> on Thu, 01 Feb 2001 17:08:16 +0100
You are using a bit outdated connectionstring:



Try this instead:



"Provider=Microsoft.Jet.OLEDB.4.0;" & _

"Data Source=" & Server.MapPath("PD.mdb") & ";" & _

"User Id=admin;" & _

"Password=;"





For more examples, look at 

http://www.able-consulting.com/ado_conn.htm#OLEDBProviderForMicrosoftJet 

under Jet



HtH



Imar





At 03:58 PM 2/1/2001 +0000, you wrote:

>I am trying to create an ASP page that will list the current continuing

>education classes that we are holding.  I would like to create a DSNless

>connection to my database, but I do not know the physical location of the

>web root on the server where my web site is.  I tried the following code,

>but it just tells me that it can't find the file.

>

><%

>   Dim oConn

>   Dim oRSit

>

>   Set oConn=Server.CreateObject ("ADODB.Connection")

>   Set oRSit=Server.CreateObject ("ADODB.Recordset")

>   oConn.ConnectionString="driver={Microsoft Access Driver (*.mdb)};DBQ=" &

>server.mappath("PD.mdb")

>   oConn.Open

>

>   oRSit.Open "COURSEsubtable", oConn

>   oRSit.MoveFirst

>%>

>

>My database is located in the fpdb folder of my web.  Perhaps I am not

>being specific enough for the location of my database.  Can anyone help?



Message #3 by "Pejvak Foroohar" <pejvak@m...> on Thu, 01 Feb 2001 14:35:46 -0800
u should find ur location on the host

put this asp file in ur hosting and it will give u the information that 

where is ur file exactly and then ... it will show u like this.



APPL_PHYSICAL_PATH C:\Inetpub\wwwroot\at\

if it was use full let me know,

Pj



<%

Option Explicit

Dim Key

%>



<HTML>

<HEAD>

<TITLE>The HTTP Server Variables Collection</TITLE>

</HEAD>



<BODY BGCOLOR=white>

<CENTER>

<H2>The HTTP Server Variables Collection</H2>

</CENTER>



<TABLE BORDER=1>

<TR>

  <TD><B>Variable Name</B></TD>

  <TD><B>Value</B></TD>

</TR>



<%

  For Each Key in Request.ServerVariables

    Response.Write "<TR><TD>" & Key & "</TD><TD>"



    If Request.ServerVariables(key) = "" Then

      Response.Write " "

    Else

      Response.Write Request.ServerVariables(key)

    End If



    Response.Write "</TD></TR>"

  Next

%>



</TABLE>

</BODY>

</HTML>



>From: "Sara Petty" <spetty@w...>

>Reply-To: "ASP Database Setup" <asp_database_setup@p...>

>To: "ASP Database Setup" <asp_database_setup@p...>

>Subject: [asp_database_setup] DSNless connections

>Date: Thu, 1 Feb 2001 15:58:19 -0000

>

>I am trying to create an ASP page that will list the current continuing

>education classes that we are holding.  I would like to create a DSNless

>connection to my database, but I do not know the physical location of the

>web root on the server where my web site is.  I tried the following code,

>but it just tells me that it can't find the file.

>

><%

>   Dim oConn

>   Dim oRSit

>

>   Set oConn=Server.CreateObject ("ADODB.Connection")

>   Set oRSit=Server.CreateObject ("ADODB.Recordset")

>   oConn.ConnectionString="driver={Microsoft Access Driver (*.mdb)};DBQ=" &

>server.mappath("PD.mdb")

>   oConn.Open

>

>   oRSit.Open "COURSEsubtable", oConn

>   oRSit.MoveFirst

>%>

>

>My database is located in the fpdb folder of my web.  Perhaps I am not

>being specific enough for the location of my database.  Can anyone help?

>

  Return to Index