不知道怎么回事,总是出现无法转的问题DAL
public List<Product> Get_SingListProduct(int Product_Id)
{
SqlParameter[] paramlist = { sqlhelp.CreateInParam("@Product_Id", SqlDbType.Int, 4, Product_Id) };
SqlDataReader dr = null;
try
{
sqlhelp.RunProc("Get_SingProduct", paramlist, out dr);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
List<Product> List_Product = new List<Product>();
while (dr.Read())
{
Product product = new Product();
product.Product_Id = Int32.Parse(dr["Product_Id"].ToString());
product.Product_Name = dr["Product_Name"].ToString();
product.Product_Description = dr["Product_Description"].ToString();
product.Product_SeeNum = Int32.Parse(dr["Product_SeeNum"].ToString());
product.Product_Image = dr["Product_Image"].ToString();
product.Product_Time = DateTime.Parse(dr["Product_Time"].ToString());
product.Product_Name = dr["Product_Name"].ToString();
product.ProType_Id = Int32.Parse(dr["ProType_Id"].ToString());
List_Product.Add(product);
product = null;
}
dr.Close();
return List_Product;
}BLL
public List<Product> Get_SingListProduct(int Product_Id)
{
return dl.Get_SingListProduct(Product_Id);
}调用:
public void a()
{
BLL.BLLcs bl = new BLLcs();
model.Product pro = new model.Product();
List<Product> productList = new List<Product>();
int a = int.Parse(Request.QueryString["Product_Id"].ToString());
string aa = Request.QueryString["Product_Id"].ToString(); productList = bl.Get_SingListProduct(a);
}
productList 总是无法接收bl.Get_SingListProduct(a),请各位看看着是怎么回事啊!!
都忙了一天了
public List<Product> Get_SingListProduct(int Product_Id)
{
SqlParameter[] paramlist = { sqlhelp.CreateInParam("@Product_Id", SqlDbType.Int, 4, Product_Id) };
SqlDataReader dr = null;
try
{
sqlhelp.RunProc("Get_SingProduct", paramlist, out dr);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
List<Product> List_Product = new List<Product>();
while (dr.Read())
{
Product product = new Product();
product.Product_Id = Int32.Parse(dr["Product_Id"].ToString());
product.Product_Name = dr["Product_Name"].ToString();
product.Product_Description = dr["Product_Description"].ToString();
product.Product_SeeNum = Int32.Parse(dr["Product_SeeNum"].ToString());
product.Product_Image = dr["Product_Image"].ToString();
product.Product_Time = DateTime.Parse(dr["Product_Time"].ToString());
product.Product_Name = dr["Product_Name"].ToString();
product.ProType_Id = Int32.Parse(dr["ProType_Id"].ToString());
List_Product.Add(product);
product = null;
}
dr.Close();
return List_Product;
}BLL
public List<Product> Get_SingListProduct(int Product_Id)
{
return dl.Get_SingListProduct(Product_Id);
}调用:
public void a()
{
BLL.BLLcs bl = new BLLcs();
model.Product pro = new model.Product();
List<Product> productList = new List<Product>();
int a = int.Parse(Request.QueryString["Product_Id"].ToString());
string aa = Request.QueryString["Product_Id"].ToString(); productList = bl.Get_SingListProduct(a);
}
productList 总是无法接收bl.Get_SingListProduct(a),请各位看看着是怎么回事啊!!
都忙了一天了
List_Product,是否有异常
List<Product> productList = new List<Product>();model.Product和Product是不是同一个实体类?
List<Product> productList = new List<Product>();Product和pro( model.Product )是同个类型吗?