Hi,
I'm a very very new to ASP. I have an access dbase and I am trying to use ASP to display the fields in the dbase. One of the fields contains a path to the folder containing the images(got this idea after reading some previous threads).The problem I am having is the images don't show.
I have two ASP files; the first one is named plantdbase.asp and it is:
...
<%
Set cn = Server.CreateObject("ADODB.Connection"
Constr = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & Server.MapPath("./Data/plantdbase.mdb"
& ";Persist Security Info=False"
cn.Connectionstring = Constr
cn.Open
strSQL = "SELECT PlantPic FROM Plants WHERE ID =" & requesT("ID"
Set rs = Server.CreateObject("ADODB.Recordset"
rs.open strSQL, cn, adOpenStatic, adLockOptimistic, adCmdText
Response.ContentType ="image/jpg"
Response.BinaryWrite rs("PlantPic"
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
%>
The second one which is supposed to diplay the reults is:
...
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adLockOptimistic = 3
strSQL = "SELECT * FROM Plants ORDER BY PID"
Set cn = Server.CreateObject("ADODB.Connection"
Constr = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & Server.MapPath("./Data/plantdbase.mdb"
& ";Persist Security Info=False"
cn.Connectionstring = Constr
cn.Open
%>
<%
Set rs = Server.CreateObject("ADODB.Recordset"
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
set rs = cn.Execute(strSQL)
Do While NOT rs.EOF
%>
<ul>
<li> <IMG SRC="PlantDbase.asp?ID=<%=RS("PID"
%> width=" border="0" 200"> <%=RS("ScientificName"
%></a>
<%=RS("OtherNames"
%>
<%
RS.Movenext
loop
%>
Please tell me what's wrong with my code. Need help. Thanks.
Pkuti
I'm a very very new to ASP. I have an access dbase and I am trying to use ASP to display the fields in the dbase. One of the fields contains a path to the folder containing the images(got this idea after reading some previous threads).The problem I am having is the images don't show.
I have two ASP files; the first one is named plantdbase.asp and it is:
...
<%
Set cn = Server.CreateObject("ADODB.Connection"
Constr = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & Server.MapPath("./Data/plantdbase.mdb"
cn.Connectionstring = Constr
cn.Open
strSQL = "SELECT PlantPic FROM Plants WHERE ID =" & requesT("ID"
Set rs = Server.CreateObject("ADODB.Recordset"
rs.open strSQL, cn, adOpenStatic, adLockOptimistic, adCmdText
Response.ContentType ="image/jpg"
Response.BinaryWrite rs("PlantPic"
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
%>
The second one which is supposed to diplay the reults is:
...
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adLockOptimistic = 3
strSQL = "SELECT * FROM Plants ORDER BY PID"
Set cn = Server.CreateObject("ADODB.Connection"
Constr = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & Server.MapPath("./Data/plantdbase.mdb"
cn.Connectionstring = Constr
cn.Open
%>
<%
Set rs = Server.CreateObject("ADODB.Recordset"
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
set rs = cn.Execute(strSQL)
Do While NOT rs.EOF
%>
<ul>
<li> <IMG SRC="PlantDbase.asp?ID=<%=RS("PID"
<%=RS("OtherNames"
<%
RS.Movenext
loop
%>
Please tell me what's wrong with my code. Need help. Thanks.
Pkuti