c# dropdownlist数据字段绑定问题
SelectCommand="SELECTdistinctdm,dhFROM[daa01]">为什么?<asp:SqlDataSourceID="SqlDataSourc...
SelectCommand="SELECT distinct dm,dh FROM [daa01]">
为什么?
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:mfy %>"
ProviderName="<%$ ConnectionStrings:mfy.ProviderName %>"
SelectCommand="SELECT dm,dh FROM [daa01]">
</asp:SqlDataSource> 展开
为什么?
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:mfy %>"
ProviderName="<%$ ConnectionStrings:mfy.ProviderName %>"
SelectCommand="SELECT dm,dh FROM [daa01]">
</asp:SqlDataSource> 展开
1个回答
展开全部
这不是DropDownList 而是数据源。。。。
DropDownList 是这样写的
前台a.aspx:
<asp:DropDownList ID="DropDownList1" runat="server" Width="250px" ></asp:DropDownList>
后台a.aspx.cs:
DropDownList1.DataSource = ZWL.DBUtility.DbHelperSQL.GetDataTable("select ID,JuanKuName from ERPJuanKu");
DropDownList1.DataTextField = "JuanKuName";
DropDownList1.DataValueField = "ID";
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, new ListItem("", ""));
DropDownList1.SelectedIndex = 0;
//模仿这个
DropDownList 是这样写的
前台a.aspx:
<asp:DropDownList ID="DropDownList1" runat="server" Width="250px" ></asp:DropDownList>
后台a.aspx.cs:
DropDownList1.DataSource = ZWL.DBUtility.DbHelperSQL.GetDataTable("select ID,JuanKuName from ERPJuanKu");
DropDownList1.DataTextField = "JuanKuName";
DropDownList1.DataValueField = "ID";
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, new ListItem("", ""));
DropDownList1.SelectedIndex = 0;
//模仿这个
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询