/// <summary>
/// 绑定产品信息到网络列表
/// </summary>
private void BindProduct()
{
Pros = new List<ProductClass>();
SqlDataReader sdr = SqlHelper.Read("SELECT Id,JWD,ProName,ProNum,ProStyle FROM dbo.product");
while (sdr.Read())
{
ProductClass pro = new ProductClass();//为什么不能写到while语句外面
pro.Id = Convert.ToInt32(sdr["Id"]);
pro.JWD = sdr["JWD"].ToString();
pro.ProName = sdr["ProName"].ToString();
pro.ProNum = sdr["ProNum"].ToString();
pro.ProStyle = sdr["ProStyle"].ToString();
Pros.Add(pro);
}
sdr.Close();
dgvProduct.DataSource = Pros;
}