|
 |
asp_databases thread: Server.MapPath() error 'ASP 0172 : 80004005'
Message #1 by "yzet" <yzetvida@y...> on Thu, 5 Sep 2002 12:59:43
|
|
Hi!
i got the ff. error when i load the site
d:\inetpub\exe\db\qs.mdb
Server.MapPath() error 'ASP 0172 : 80004005'
Invalid Path
/quintasinfonia/include/qs.asp, line 16
The Path parameter for the MapPath method must be a virtual path. A
physical path was used
=====below is the script======
<%
'Se não especificar, assumir a raiz do site
If path = "" then path = "."
' Abrir ligação DSNLess à base de dados
'CnDb = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath
(path & "/database/qs.mdb") & ";"
dbqs=server.mappath("./../../db/qs.mdb")
%>
<%=dbqs%>
<%
CnDb="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
CnDb=CnDb & server.mappath(dbqs) & ";"
%>
<% 'Mostra as novidades
sub GetNovidades
'Seleccionar os temas principais
SqlString = "SELECT Top 6 Format(Data,'yyyy.mm.dd') As DataF, Novidades.*
FROM Novidades ORDER BY Data DESC;"
'Criar um recordset
Set RsNews = Server.CreateObject("ADODB.Recordset")
'Abrir o recordset
RsNews.Open SqlString,CnDb,2,1
while not RsNews.eof
if Session("l") = "2" then %>
<tr><td valign="top"><p class="smalljustify"><b><%=RsNews
("DataF")%></b><br><%=RsNews("NovidadeUK")%></td></tr>
<% else %>
<tr><td valign="top"><p class="smalljustify"><b><%=RsNews
("DataF")%></b><br><%=RsNews("NovidadePT")%><br></td></tr>
<% end if
RsNews.movenext
wend
'Fechar o Recordset
RsNews.Close
Set RsNews = nothing
end sub%>
Message #2 by "Drew, Ron" <RDrew@B...> on Thu, 5 Sep 2002 08:04:23 -0400
|
|
I use a variable for mappath like so check your backslashes...
Dim mdbPath
mdbPath =3D Server.MapPath("..\xxx\yyy.mdb")
objConn.Open "Provider=3DMicrosoft.Jet.OLEDB.4.0;" & _
"Data Source=3D" & mdbPath & ";" & _
"User Id=3Dadmin;" & _
"Password=3D;"
-----Original Message-----
From: yzet [mailto:yzetvida@y...]
Sent: Thursday, September 05, 2002 9:00 AM
To: ASP Databases
Subject: [asp_databases] Server.MapPath() error 'ASP 0172 : 80004005'
Hi!
i got the ff. error when i load the site
d:\inetpub\exe\db\qs.mdb
Server.MapPath() error 'ASP 0172 : 80004005'
Invalid Path
/quintasinfonia/include/qs.asp, line 16
The Path parameter for the MapPath method must be a virtual path. A
physical path was used
=3D=3D=3D=3D=3Dbelow is the script=3D=3D=3D=3D=3D=3D
<%
'Se n=E3o especificar, assumir a raiz do site
If path =3D "" then path =3D "."
' Abrir liga=E7=E3o DSNLess =E0 base de dados
'CnDb =3D "DRIVER=3D{Microsoft Access Driver (*.mdb)};DBQ=3D" &
Server.Mappath
(path & "/database/qs.mdb") & ";"
dbqs=3Dserver.mappath("./../../db/qs.mdb")
%>
<%=3Ddbqs%>
<%
CnDb=3D"PROVIDER=3DMicrosoft.Jet.OLEDB.4.0;DATA SOURCE=3D"
CnDb=3DCnDb & server.mappath(dbqs) & ";"
%>
<% 'Mostra as novidades
sub GetNovidades
'Seleccionar os temas principais
SqlString =3D "SELECT Top 6 Format(Data,'yyyy.mm.dd') As DataF,
Novidades.*
FROM Novidades ORDER BY Data DESC;"
'Criar um recordset
Set RsNews =3D Server.CreateObject("ADODB.Recordset")
'Abrir o recordset
RsNews.Open SqlString,CnDb,2,1
while not RsNews.eof
if Session("l") =3D "2" then %>
<tr><td valign=3D"top"><p class=3D"smalljustify"><b><%=3DRsNews
("DataF")%></b><br><%=3DRsNews("NovidadeUK")%></td></tr>
<% else %>
<tr><td valign=3D"top"><p class=3D"smalljustify"><b><%=3DRsNews
("DataF")%></b><br><%=3DRsNews("NovidadePT")%><br></td></tr>
<% end if
RsNews.movenext
wend
'Fechar o Recordset
RsNews.Close
Set RsNews =3D nothing
end sub%>
|
|
 |