初学者请教。三层 读取数据DataRow读取数据

hard171730 hard171730 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
----------------------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();

不是这样绑定数据的吗? 为啥报错呢?
...全文
评论 12
收藏 已收藏
分享
返回顶部
hard171730
.NET社区 62,271 成员 668,968 内容