Determine if any records are returned

If want to use the following to return a group of records from an access database.  How would i determine if any records were returned or not?


 Dim cn As New OleDbConnection(Global_Values.strConn)
        Dim cmd As New OleDbCommand(sSQL, cn)
        Dim dr As OleDbDataReader

        If cn.State = Data.ConnectionState.Closed Then
            cn.Open()
        End If

        dr = cmd.ExecuteReader
Mike_StevensAsked:
Who is Participating?
 
YZlatCommented:
or

if dr.HasRows then

end if
0
 
YZlatCommented:
While dr.Read

End while
0
 
strickddCommented:
or even

if dr.ReadI() then

end if
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.