如何在数据GridView中绑定数据? [英] How To Bind Data In Data GridView ?
本文介绍了如何在数据GridView中绑定数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发了一个售书员应用程序.过期后在数据库中订阅的客户显示在数据网格"视图中.
Hi,
I am developed one Book Seller Application.In data Base after date expire Subscribed Customers display in Data Grid view. How to Display the Data Grid view.?
推荐答案
关注链接:
在具有搜索功能的GridView中显示数据 [ ^ ]
这个很好! [
Follow the links:
Display Data in GridView with Search Functionality[^]
This one is Good[^]
我认为此代码项目文章可能也有帮助
用于从DataBase和使用反射将DataTable保存到数据库中 [
I think this Code Project article may also be helpful
General purpose class to fill DataTable(s) from DataBase and to save DataTable(s) to DataBase using reflection[^]
表格:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind();
}
}
public void Bind()
{
setConnectionString();
query = "select * from userinfo";
//Session["GridView1"] = EmpBal.bindgridBAL(query, conString);
DataSet ds = EmpBal.bindgridBAL(query, conString);
GridView1.DataSource = ds;
GridView1.DataBind();
}
数据层:
Data Layer:
public DataSet bindgridDAL(string query, string conString)
{
try
{
SqlDataAdapter da = new SqlDataAdapter(query,conString);
ds = new DataSet();
da.Fill(ds, "EmpDetail");
da.Dispose();
}
catch (Exception ex)
{
throw ex;
}
return ds;
}
它适用于三层体系结构.
业务层:
it is for 3 tier architecture.
Business layer:
Public DataSet bindgridBAL(string query, string conString)
{
try
{
return empDAL.bindgridDAL(query, conString);
}
catch (Exception ex)
{
throw ex;
}
}
这篇关于如何在数据GridView中绑定数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文