thanks @deepesh.solanki and @pavanh003 . It was helpful. Also I am doing this
and saving this to a datatable however if there is no record, it thorws exception.
@p4uk80 You can run this query in try block and in catch block check the exception message if exception.message = “The source contains no DataRows” than assign some value like True/False in variable and if message is deferent then rethrow the exception.