how does highlighted lines work.............
public List<clsproductprp> RetAllCol_rec()
{
List<clsproductprp> obj = new List<clsproductprp>();
SqlDataReader dr=null;
SqlCommand discmd = new SqlCommand();
try
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
discmd.CommandText = "spDisplayALLProduct";
discmd.CommandType = CommandType.StoredProcedure;
discmd.Connection = con;
[B] dr = discmd.ExecuteReader();[/B]
while (dr.Read())
{
clsproductprp prp = new clsproductprp();
prp.productnameprp = dr["Producname"].ToString();
prp.Quantityperunitprp = Convert.ToInt32(dr["Quantityperunit"].ToString());
prp.unitinStockprp = Convert.ToInt32(dr["unitinstock"].ToString());
prp.unitPriceprp = Convert.ToInt32(dr["unitPrice"].ToString());
prp.productidprp = Convert.ToInt32(dr["Productid"].ToString());
[B] obj.Add(prp);[/B]
}
}
catch { }
finally
{
dr.Close();
discmd.Dispose();
}
return obj;
}