如何绑定数据库中的数据 [英] how to bind data from database

查看:87
本文介绍了如何绑定数据库中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过使用Container.DataItem,如何从数据库绑定数据?

By using Container.DataItem, how to bind data from database?

推荐答案

尝试此链接

点击 [ ^ ]
try this link

Click[^]


在数据库端执行查询后,将使用数据适配器获取记录.一次将适配器记录填充到数据集中.数据集必须具有行和列形式的记录.最后将控件的数据源附加到数据集.然后数据将绑定到控件中

例如:
Gridview1.datatsource = ds;
Gridview.DataBind()
once the query is executed in database side u get the records using data adaper. once fill the adapter records into dataset. dataset must has the records in the form of rows and columns. finally attach the datasource of the control with dataset. Then Datas will bind into the control

Ex:
Gridview1.datatsource = ds;
Gridview.DataBind()


您需要做的

You need to do

<br />
 < ((Customer)Container.DataItem).CustomerID.ToString(); ><br />



并绑定datasouce



And to bind datasouce

Gridview1.datatsource = ds;
Gridview.DataBind()


这篇关于如何绑定数据库中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆