Exception throws There is no row at position 0
- by Nimantha Prasad
I wanted to check user is valid or not.it gives me the exception,When user valid it's working without issue,But if user invalid there's some issue.
Exception is : There is no row at position 0
Here is the part of the code,
public bool CheckUserExistAndReporter(string user)
{
int reporterDnnId = -1;
SMSFunctionController mysms = new SMSFunctionController();
DataSet uds = mysms.GetUsersUnitByUserName(user);
reporterDnnId = Convert.ToInt32(uds.Tables[0].Rows[0]["DnnUserID"]);
if (reporterDnnId > 0)
{
bool isValidUser = true;
return isValidUser;
}
//else
//{
//bool isValidUser =false;
//return isValidUser;
// }
return false;
}
Then i call thatone here.
if (!CheckUserExistAndReporter(user))
{
ErrorLog(messageIn);
msgOut = "ugyldig Bruker";//Invalid User.
}
what is the error ?