none
No Rows Returned RRS feed

  • Question

  •  

    Hello Experts,

     

    If I do the following:

     

    Code Snippet

    Dim Accounts = from a in dc.tblAccounts _

    Where a.myField = "fafa"

     

    I need to check if any rows were returned how can I do that?

     

    Is there a function like Accounts.hasRows()?

     

    Thanks,

    Sorcerdon

    Monday, August 25, 2008 6:25 PM

Answers

All replies

  • If Accounts.Count > 0 Then ...

     

    [)amien

    Monday, August 25, 2008 6:47 PM
    Moderator
  • ...and to avoid hitting the database more than once with the same query, "ToList" it before checking counts etc...  (assuming you will reference the same query again after checking the .Count)

     

    Tuesday, August 26, 2008 4:34 AM
    Answerer