getting only 1 value

Jun 1 2014 2:00 AM
public List login(string salesmanname, string usercode)
{
List customers = new List();
con.Open();
using (SqlCommand cmd = new SqlCommand("Select Id, CompanyRefId from SalesMan where salesmanname=@salesmanname and code=@usercode", con))
{
cmd.Parameters.AddWithValue("@salesmanname", salesmanname);
cmd.Parameters.AddWithValue("@usercode", usercode);
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
customer c1 = new customer();
c1.id = (int)reader["Id"];
c1.companyrefid = (Guid)reader["CompanyRefId"];
customers.Add(c1);

}
return customers;
}


}
}
this is the code i have used but i am getting only id value and not companyrefid while returning in list .how to get both ?.using break point i checked i am getting id value and companyrefrid.



Answers (2)