Good morning,
I am trying to retrieve the list of customer from the database
I have the following code
public List ListOfCustomer()
{
SqlConnection myCon = new SqlConnection();
string strConString = ConfigurationManager.ConnectionStrings[0].ConnectionString;
myCon.ConnectionString = strConString;
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "UP_SELECT_CUSTOMER_BY_STOREID";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@StoreID", 1);
SqlDataAdapter daCustomer = new SqlDataAdapter(cmd);
DataSet dsCustomer = new DataSet();
daCustomer.Fill(dsCustomer);
List CustList = new List();
return CustList;
}
{
SqlConnection myCon = new SqlConnection();
string strConString = ConfigurationManager.ConnectionStrings[0].ConnectionString;
myCon.ConnectionString = strConString;
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "UP_SELECT_CUSTOMER_BY_STOREID";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@StoreID", 1);
SqlDataAdapter daCustomer = new SqlDataAdapter(cmd);
DataSet dsCustomer = new DataSet();
daCustomer.Fill(dsCustomer);
List
return CustList;
}
I can't figure out how to add the retrieve data to the list
Can someone help me please
thank you in advance
Suraj KumarPosted Jan 13, 2020, 11:52 AM