Table: employee
code|Name|Left
----+----+----
1 | A | Y
2 | B | N
3 | C | N
4 | D | Y
5 | E | N
6 | F | Y
now i am doing ,
SqlConnection cn=new SqlConnection();
SqlCommand cmd = new SqlCommand();
cn.ConnectionString="<CONNECTION STRING>"
List<string> str = new List<string>();
cmd.Connection=cn;
cmd.Connection.Open();
cmd.CommandText="Select code from employee where Left='Y'";
SqlDataReader dr=cmd.executeReader();
while(dr.Read())
{
str.Add(dr1.GetValue(0).ToString());
}
foreach (string p in str)
{
Response.Write(p);
}
This code fetch only 1 data, how may i get all data whose Left='Y'
