avijit1112010 wrote:
string mname = Convert.ToString(dtName.Rows[0].ItemArray[1]);
string lname = Convert.ToString(dtName.Rows[0].ItemArray[2]);
This looks like a possible place for the exception.
To code based on ItemArray indexed with numbers are not good, keeping that aside.. whenever you are using it, make sure you have that right and is not null.
Check for null before accessing the ItemArray's data.