diarratech
Technical User
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("strConnect" = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("Contact/Contact.mdb" & ";"
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 "contact.mdb" but when I move my db and my 2 files in the "contact" folder contact.asp I have "page cannot display error.
Here sample code for contact.asp
<form Name=sMethod2 method="post" Action ="searchConnect2.asp">
<CENTER><INPUT type="submit" value="Search" ></CENTER>
</form>
Here is searchconnect2.asp
<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection"
Set objRS = Server.CreateObject("ADODB.Recordset"
objConn.Open Application("strConnect"
objRS.Open "contact", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable
While Not objRS.EOF
Response.Write objRS("id" & "<BR>"
objRS.MoveNext
Wend
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
Thanks
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
Application("strConnect" = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("Contact/Contact.mdb" & ";"
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 "contact.mdb" but when I move my db and my 2 files in the "contact" folder contact.asp I have "page cannot display error.
Here sample code for contact.asp
<form Name=sMethod2 method="post" Action ="searchConnect2.asp">
<CENTER><INPUT type="submit" value="Search" ></CENTER>
</form>
Here is searchconnect2.asp
<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection"
Set objRS = Server.CreateObject("ADODB.Recordset"
objConn.Open Application("strConnect"
objRS.Open "contact", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable
While Not objRS.EOF
Response.Write objRS("id" & "<BR>"
objRS.MoveNext
Wend
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
Thanks