为什么要这样绑定呢?
TextBox1.Text = dataset11.Tables[Employees].Rows[0]FirstName;
就可以了
TextBox1.Text = dataset11.Tables[Employees].Rows[0]FirstName;
就可以了
解决方案 »
- GridView中,HyperLinkField 点击下载。在线等
- SQLHelper和SqlCommand的区别!!!
- 关于dataset的重组
- 用页面模板、用户控件、框架还是相结合??
- .net 2003 的安装问题
- 请问:asp.net 中,当鼠标移到datagrid一模板列中的表的一列上时,把这列的内容以替换方本显示,怎样做?
- 关于Gridview 模板列的问题?
- 关于项目图片存放的问题
- 一个有关数据库绑定下拉框的问题,急啊~~~
- 超级巨难题,解决问题独得150分,你的英名将载入史册?
- 连接问题~~~郁闷死了~~~~(在线~~~~~~)
- 如何把一个DataColumn加在DataTable的指定位置?
TextBox1.Text = dataset11.Tables[Employees].Rows[0]["FirstName"];
dad.SelectCommand = New OleDbCommand("select * from location where residentid=" + CStr(rid), con)
dad.Fill(dst, "location")
dtb = dst.Tables("location")
If dtb.Rows.Count = 1 Then
drow = dtb.Rows(0)
section.Text = drow("section")
ward.Text = drow("ward")
room.Text = drow("room")
bed.Text = drow("bed") End If
Catch io As Exception
Response.Write(io.ToString()) End Try
高手,我只是想绑定, 并不是要赋值呀
在后台TextBox1.Text = dataset11.Tables[Employees].Rows[0]["FirstName"];
就可以得到了。
如果你想绑定数据库中的数据到TextBox,可以把这个TextBox放到一个datalist或reaptear里面。因为TextBox自己不能绑定数据库,而在数据绑定组建里面可以通过设定他的Text=‘<%# DataBinderee.Eval()%》’来实现。
下面是从设计器里面的DataBindings属性中绑定好, 生成的Html代码, 我只是想用Server端的代码实现它而已:
<asp:textbox id="TextBox1" style="Z-INDEX: 102; LEFT: 120px; POSITION: absolute; TOP: 48px" runat="server" Text='<%# DataBinder.Eval(dataSet11, "Tables[Employees].DefaultView.[0].FirstName") %>'></asp:textbox>请注意Text属性:Text='<%# DataBinder.Eval(dataSet11, "Tables[Employees].DefaultView.[0].FirstName") %>'
这个东西只有静态可以设, 动态就不能设?
不知你说的reaptear是不是Repeater, 但是Repeater里面也不能放TextBox呀