初学者请教。三层 读取数据DataRow读取数据
----------------------DAL--------------------------
public static DataRow GetProductRow(int ProductID)
{
StringBuilder sb = new StringBuilder();
sb.Append("select * from Product where Product_ID=").Append(ProductID);
return SqlHelper.ExecuteDataRow(DBConnection.Conn.ConnectionString, CommandType.Text, sb.ToString());
}
----------------------BLL--------------------------
public DataRow GetProductRow(int ProductID)
{
return DAL.ProductDAL.GetProductRow(ProductID);
}
----------------------后台绑定到Textox--------------------------
int productId = 5;
DataRow dr = new DataRow();
dr=new BLL.ProductBLL().GetProductRow(productId);
sproduct_Name.Text = dr["product_Name"].ToString();
scost_Price.Text=dr["cost_Price"].ToString();
不是这样绑定数据的吗? 为啥报错呢?
public static DataRow GetProductRow(int ProductID)
{
StringBuilder sb = new StringBuilder();
sb.Append("select * from Product where Product_ID=").Append(ProductID);
return SqlHelper.ExecuteDataRow(DBConnection.Conn.ConnectionString, CommandType.Text, sb.ToString());
}
----------------------BLL--------------------------
public DataRow GetProductRow(int ProductID)
{
return DAL.ProductDAL.GetProductRow(ProductID);
}
----------------------后台绑定到Textox--------------------------
int productId = 5;
DataRow dr = new DataRow();
dr=new BLL.ProductBLL().GetProductRow(productId);
sproduct_Name.Text = dr["product_Name"].ToString();
scost_Price.Text=dr["cost_Price"].ToString();
不是这样绑定数据的吗? 为啥报错呢?
...全文
相关推荐
获取DataRow[]的值示例
而DataRow则是DataTable中的一个实例,代表了表中的一行记录。在处理数据库查询结果或进行数据操作时,我们经常需要从DataRow对象中提取数据。
DataSet、DataTable、DataRow区别详解
最后,DataRow代表DataTable中的一行数据。每一行可以包含多个字段,可以看作是数据库中一个表的实例化记录。
DataRow 传换成 DataTable
### 一、理解DataRow和DataTable在开始之前,首先需要明确`DataRow`和`DataTable`的概念:- **DataRow**:表示`DataTable`中的单个数据行。
探讨 ADO.NET DataRow
总的来说,ADO.NET 的 DataRow 提供了强大的功能来处理和操作数据。
将DataRow转成指定类型的类,并返回这个类的对象(带值)
将DataRow转换成指定类型的类对象在编程中,经常需要将DataRow转换成指定类型的类对象,以便于后续的数据处理和操作。本文将详细介绍如何将DataRow转换成指定类型的类对象,并返回该类的对


