jon24422531
Technical User
Hi guys
I have an asp page with a SQL query that returns a result set to a table, and it works well. (Thanks mainly to all your help in the past!)
What I am trying to do is an IF statement so that if there is no result I want to response.Write something to that effect rather than show table headers with no results.
I did try an If before the headers:
if fieldItem.name = "null" then
response.write "You have no Worklogs"
else
with an end If but it didn't work.
Can any one help with the correct syntax please?
Jonathan
I have an asp page with a SQL query that returns a result set to a table, and it works well. (Thanks mainly to all your help in the past!)
Code:
<table border='0'>
<tr>
<%
for each fieldItem in rsData.fields
Response.Write vbTab & vbTab &"<td bgcolor=""#EBDDE2""><strong>" & fieldItem.name
Response.Write "</strong></td>" & vbCrLf
next
Response.Write vbTab & "</tr>" & vbCrLf
%>
</tr>
<%
Do While not rsData.EOF
Response.Write "<tr>"
for each fieldItem in rsData.fields
if fieldItem.name = "FaultNo" then
Response.Write "<td> <a href=""MyWorklogEdit.asp?id=" & fieldItem.Value & """>" & fieldItem.value & "</a></td>"
else
Response.Write "<td> " & fieldItem.value & "</td>"
end if
next
Response.Write "</tr>"
rsData.MoveNext
Loop
%>
</table>
I did try an If before the headers:
if fieldItem.name = "null" then
response.write "You have no Worklogs"
else
with an end If but it didn't work.
Can any one help with the correct syntax please?
Jonathan