Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Beginner simple ASP path problem

Status
Not open for further replies.

diarratech

Technical User
Jul 7, 2000
41
FR
1) I have a global.asa in my root directory of my web server which points to my db:
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
Application(&quot;strConnect&quot;) = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; & Server.Mappath(&quot;Contact/Contact.mdb&quot;) & &quot;;&quot;
End Sub
</SCRIPT>

2. I have also 2 asp files in my contact folder: contact.asp and searchconnect2.asp
The contact.asp is just a test to connect to my db and retrieve some data from my db.

My problem is that everything works fine when I put my contact.mdb + my 2 files in the root directory (and changing the Server.Mappath to just &quot;contact.mdb&quot;) but when I move my db and my 2 files in the &quot;contact&quot; folder contact.asp I have &quot;page cannot display error.

Here sample code for contact.asp
<form Name=sMethod2 method=&quot;post&quot; Action =&quot;searchConnect2.asp&quot;>
<CENTER><INPUT type=&quot;submit&quot; value=&quot;Search&quot; ></CENTER>
</form>

Here is searchconnect2.asp
<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2

Dim objConn, objRS
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set objRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)

objConn.Open Application(&quot;strConnect&quot;)
objRS.Open &quot;contact&quot;, objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable
While Not objRS.EOF
Response.Write objRS(&quot;id&quot;) & &quot;<BR>&quot;
objRS.MoveNext
Wend
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top