I have
staff table
staff_Id
staff_Accesscode values (access123,code123,staff12)....
i have done like this for getting all values in staff_accesscode
DataTable dt2 = null;
string sql = @"SELECT staff_AccessCode FROM staff";
dt2 = xxxxxx.GetData(sql, gBaseUrl);
if (dt2 != null && dt2.Rows.Count > 0)
{
accessname = dt2.Rows[0]["staff_AccessCode"].ToString();
}
but the problem is it returns only last value stored in staff_Accesscode, I mean it returns only this value (staff12)
now i want to get the all values stored in staff_Accesscode field and further i want to check this value with the txtbox.text
You are accessing the first row (with index 0) only.
You might iterate through the complete result set: