2个回答
2013-10-24
展开全部
winform comboBox 绑定数据方法
//C#
private void BindComboBox()
{
comboBox1.DataSource = dataSet1.Tables["Suppliers"];
comboBox1.DisplayMember = "数据表列名";
comboBox1.valueMember = "列名对应的值";
}
//VB
Private Sub BindComboBox()
ComboBox1.DataSource = DataSet1.Tables("Suppliers")
ComboBox1.DisplayMember = "数据表列名"
ComboBox1.DisplayMember = "列名对应的值"
End Sub
webform DropDownList 绑定方法:
private void BindDropDownList1()
{
DataTable dt = dataSet1.Tables["Suppliers"];
this.DropDownList1.DataSource = dt;
this.DropDownList1.DataTextField = "name";
this.DropDownList1.DataValueField = "fid";
this.DropDownList1.DataBind();
}
//C#
private void BindComboBox()
{
comboBox1.DataSource = dataSet1.Tables["Suppliers"];
comboBox1.DisplayMember = "数据表列名";
comboBox1.valueMember = "列名对应的值";
}
//VB
Private Sub BindComboBox()
ComboBox1.DataSource = DataSet1.Tables("Suppliers")
ComboBox1.DisplayMember = "数据表列名"
ComboBox1.DisplayMember = "列名对应的值"
End Sub
webform DropDownList 绑定方法:
private void BindDropDownList1()
{
DataTable dt = dataSet1.Tables["Suppliers"];
this.DropDownList1.DataSource = dt;
this.DropDownList1.DataTextField = "name";
this.DropDownList1.DataValueField = "fid";
this.DropDownList1.DataBind();
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-24
展开全部
<?php
mysql_connect("localhost","root","");
mysql_select_db("bhsj");
mysql_query("set names utf-8");
$query=mysql_query("select * from biao");?>
<select name="xiala">
<?php
while($data1=mysql_fetch_array($query))
{
?>
<option value="<?php echo $data1[id] ?>"><?php echo $data1['title'] ?></option>
<?php
}
?>
</select>
mysql_connect("localhost","root","");
mysql_select_db("bhsj");
mysql_query("set names utf-8");
$query=mysql_query("select * from biao");?>
<select name="xiala">
<?php
while($data1=mysql_fetch_array($query))
{
?>
<option value="<?php echo $data1[id] ?>"><?php echo $data1['title'] ?></option>
<?php
}
?>
</select>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询