Reputation: 11086
I have a function which queries database using a key and writes some data relating to that key. I want to check if there was any result returned but none of these works:
function special(key)
'some code to querying to database and get a result
response.write result
'also response.write combination of html and texts and number
' if (some conditions) then (also response.write something more)
end function
first try:
if special("fp") then
response.write "found"
end if
second try:
if not(isNull(special("fp"))) then
response.write "found"
end if
Upvotes: 0
Views: 183
Reputation: 878
As @Ansgar pointed out, you need your function to return something. So if your function is like:
function special(key)
'some code to querying to database and get a result
response.write result
'also response.write combination of html and texts and number
' if (some conditions) then (also response.write something more)
' to determine if data was returned, you would need the following line. It assumes you have a recordset variable named rs that either returns data or not
special = rs.BOF and rs.EOF
end function
if rs.BOF is true, and RS.eof is true, then no fata was found:
if special("fp") then
Response.Write "no value found"
else
' data was found, proceed with whatever happens next on the page
Upvotes: 1