MavsteR
Apr 28th, 2004, 07:57 AM
Hi, getting a small error with some of my code, just wondered if anyone knew where i was going wrong. Basically all i want it to do is if there are no records within the database, for it to write a statement saying just this. Is this possible with XML declerations in the coding... The code that i have at the moment is as follows
<%
response.ContentType = "text/xml"
Set ObjConn = Server.CreateObject("ADODB.Connection")
ObjConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("xml.mdb")
ObjConn.Open
sql="SELECT * FROM Fishing"
set rs=ObjConn.Execute(sql)
if rs.BOF and rs.EOF then
response.write("No Products Matching That Description")
else
rs.MoveFirst()
response.write("<?xml version='1.0' encoding='ISO-8859-1'?>")
response.write("<FatherGifts>")
while (not rs.EOF)
response.write ("<Fishing>")
response.write("<FishName>" & rs("FishName") & "</FishName>")
response.write("<FishPrice>" & rs("FishPrice") & "</FishPrice>")
response.write("<FishDesc>" & rs("FishDesc") & "</FishDesc>")
response.write ("</Fishing>")
rs.MoveNext()
wend
response.write("</FatherGifts>")
end if
rs.close()
ObjConn.close()
%>
Any help would be much appriciated!
<%
response.ContentType = "text/xml"
Set ObjConn = Server.CreateObject("ADODB.Connection")
ObjConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("xml.mdb")
ObjConn.Open
sql="SELECT * FROM Fishing"
set rs=ObjConn.Execute(sql)
if rs.BOF and rs.EOF then
response.write("No Products Matching That Description")
else
rs.MoveFirst()
response.write("<?xml version='1.0' encoding='ISO-8859-1'?>")
response.write("<FatherGifts>")
while (not rs.EOF)
response.write ("<Fishing>")
response.write("<FishName>" & rs("FishName") & "</FishName>")
response.write("<FishPrice>" & rs("FishPrice") & "</FishPrice>")
response.write("<FishDesc>" & rs("FishDesc") & "</FishDesc>")
response.write ("</Fishing>")
rs.MoveNext()
wend
response.write("</FatherGifts>")
end if
rs.close()
ObjConn.close()
%>
Any help would be much appriciated!