B
Bob Green via .NET 247
I want to know how to determine if a qry through ASP to a access database returns nothing (ie. there is no record that matches the query). I want to write a message stating no matches found if no records match the search.
Here's the portion of code:
<%
dim strArtType
Set objRS = Server.CreateObject("ADODB.recordset")
objRS.open strSQL, strConnect
**!!?? Is there a boolean result for something like this??!!**
if objRS("Title") = empty then
response.write "The value of title is: "& objRS ("Title")
end if
if objRS("Title") = "" then
response.write "<br>~~No art matches search as entered~~<br>"
end if
do while not objRS.EOF
response.write "<TR>"
response.write "<TD><p>'" & objRS("Title") & "'</p></TD>"
response.write "<TD><p>" & objRS("Name")
"</p></TD>"
response.write "<TD><p>" & objRS("Date") & "</p></TD>"
if objRS("Type") = 1 then
strArtType = "Painting"
else
strArtType = "Sculpture"
end if
response.write "<TD><p>" & ">" & strArtType & "<" & "</p></TD>"
response.write "</TR>"
objRS.MoveNext
Loop
objRS.close
%>
Here's the portion of code:
<%
dim strArtType
Set objRS = Server.CreateObject("ADODB.recordset")
objRS.open strSQL, strConnect
**!!?? Is there a boolean result for something like this??!!**
if objRS("Title") = empty then
response.write "The value of title is: "& objRS ("Title")
end if
if objRS("Title") = "" then
response.write "<br>~~No art matches search as entered~~<br>"
end if
do while not objRS.EOF
response.write "<TR>"
response.write "<TD><p>'" & objRS("Title") & "'</p></TD>"
response.write "<TD><p>" & objRS("Name")
"</p></TD>"
response.write "<TD><p>" & objRS("Date") & "</p></TD>"
if objRS("Type") = 1 then
strArtType = "Painting"
else
strArtType = "Sculpture"
end if
response.write "<TD><p>" & ">" & strArtType & "<" & "</p></TD>"
response.write "</TR>"
objRS.MoveNext
Loop
objRS.close
%>