Sign in to follow this  
Followers 0
Uncle Argyle

MySQL Help handling empty sets

3 posts in this topic

Hi all,

I have a program that uses the MySQL UDF (thanks cdkid!). If I query the database I want to know how to handle a return that is an empty set.

for example, I have a query where I search the table 'apps' for a row that contains 20 in the column 'appno'

$var = _query($db, "SELECT * FROM apps WHERE appno = 20)

If no results are found, how do I handle this?

I have tried something like this, but it generates an error.

If $var.Fields("appno").value = "" Then

MsgBox(0,"Test","no results found!")

Else

Msgbox(0,"Congrats", "Result = " & $var.Fields("appno").value)

EndIf

Thanks for any help,

Mike.

Share this post


Link to post
Share on other sites



I did this and it worked for me:

With $var

If .EOF Then

(your code)

Endif

EndWith

Hi all,

I have a program that uses the MySQL UDF (thanks cdkid!). If I query the database I want to know how to handle a return that is an empty set.

for example, I have a query where I search the table 'apps' for a row that contains 20 in the column 'appno'

$var = _query($db, "SELECT * FROM apps WHERE appno = 20)

If no results are found, how do I handle this?

I have tried something like this, but it generates an error.

If $var.Fields("appno").value = "" Then

MsgBox(0,"Test","no results found!")

Else

Msgbox(0,"Congrats", "Result = " & $var.Fields("appno").value)

EndIf

Thanks for any help,

Mike.

Share this post


Link to post
Share on other sites

Thanks so much! That did it!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0