hi everyone
i want a solution for this. i tried to check a all data from datbase table using dataset with a foreach loop. but this logic check only first row not below that so any one help me to solve this problem so i can check all rows from table
code is like
con = new System.Data.SqlClient.SqlConnection();
da = new System.Data.SqlClient.SqlDataAdapter();
ds1 = new DataSet();
con.ConnectionString ="Data Source=.\\SQLEXPRESS;AttachDbFilename=D:\\Visual Studio 2008\\Projects\\OnlineTest\\OnlineTest\\App_Data\\Test.mdf;Integrated Security=True;User Instance=True";
con.Open();
String sql = "SELECT * FROM UserNew";
da = new System.Data.SqlClient.SqlDataAdapter(sql, con);
da.Fill(ds1, "UserNew");
foreach (DataRow myRow in ds1.Tables[0].Rows)
{
if (Convert.ToString(myRow[i]["u_name"]) == uname && Convert.ToString(myRow["u_pass"]) == upass)
{
return true;
}
else
return false;
i++;
}
return false;
con.Close();
}