No result from an sql search

Hi

Im looking for some code to handle the event where a search string returns a null ie "select * from table where pno=1" when there are no occurences of pno=1.

im guessing it will look something like this only more complex,

if resultset1 = null then
msgbox("No record found")
end if


the correct code would be highly appreciated =)

Comments

  • : Hi
    :
    : Im looking for some code to handle the event where a search string returns a null ie "select * from table where pno=1" when there are no occurences of pno=1.
    :
    : im guessing it will look something like this only more complex,
    :
    : if resultset1 = null then
    : msgbox("No record found")
    : end if
    :
    :
    : the correct code would be highly appreciated =)
    :
    what type of database are you using?

    but if all your trying to do is see if there are no records returned to the recordset all you have to do is test agains eof or bof like so

    [code]
    if myrecordset.eof = true or myrecordset.bof = true then
    msgbox("no records found")
    end if
    [/code]

    in case you don't know

    BOF = Beginning of file
    EOF = End of File

    the above works becase if there was any records in the recordset until you would start a the position of the first record.
    [blue]
    C:Dos
    C:Dos Run
    Run Dos Run
    [/blue]

  • Thanks,

    I will be using mysql and would need to identify whether there were no instances of that specific instance.

    cheers
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories