The following code is what I\'ve been using to retrieve user information from a sql database.
string userName = LoginUser.UserName; strin
It will be better if you use try catch for checking whether the table is empty or not , just handle the IndexOutOfRangeException exception.
try catch
IndexOutOfRangeException
Use the following logic:
try { //dataTable operations } catch(IndexOutOfRangeException) { }
For me its working.