C#高手请进:怎样动态绑定DataGridView中的combox列?

来源:百度知道 编辑:UC知道 时间:2024/05/21 11:26:49
比如:下面是我定义好的DataGridView(列后面的括号代表列类型)

编号(TextBox) 用户名(ComBox) 昵称(TextBox) 密码(TextBox)

现在我要对用户名这个列绑定到数据库中的表,能告诉应该怎么做吗?DataGridView的列是用手动设置的,还有我是要用在WinForm里面的。最好能贴个代码,小弟在此感激不尽!
要的是用代码实现!

<asp:GridView ID="GridView1" runat="server" Width="637px" AutoGenerateColumns="False" Font-Size="Smaller" AllowPaging="True" EmptyDataText="无记录" OnRowDataBound="GridView1_RowDataBound" OnPageIndexChanging="GridView1_PageIndexChanging" Height="397px">
<Columns>
<asp:BoundField DataField="stuID" HeaderText="学生学号" SortExpression="stuID" />
<asp:BoundField DataField="stuName" HeaderText="学生姓名" SortExpression="stuName" />
<asp:BoundField DataField="address" HeaderText="家庭住址" SortExpression="address" />
<asp:BoundField DataField="telephone" HeaderText="电话" SortExpression="telephone"