
COMBOBOX C#数据库
我要将P_SALES表中的P_STOREID和combobox1这个下拉列表框进行绑定,我是这么写的,可是运行的时候显示不出来,不知道错在哪里,各位大虾帮忙看看错在哪里,...
我要将P_SALES表中的P_STOREID 和 combobox1这个下拉列表框进行绑定,我是这么写的,可是运行的时候显示不出来,不知道错在哪里,各位大虾帮忙看看错在哪里,怎么改
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
DataBind();
string strSql="select distinct p_storeid from p_sales where p_date='081230'";
comboBox1.DataSource=this.SqlGetDataSet(strSql,true).Tables[0];
}
private void DataBind()
{
string strSql="select distinct p_storeid from p_sales where p_date='081230'";
comboBox1.DataSource=this.SqlGetDataSet(strSql,true).Tables[0];
} 展开
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
DataBind();
string strSql="select distinct p_storeid from p_sales where p_date='081230'";
comboBox1.DataSource=this.SqlGetDataSet(strSql,true).Tables[0];
}
private void DataBind()
{
string strSql="select distinct p_storeid from p_sales where p_date='081230'";
comboBox1.DataSource=this.SqlGetDataSet(strSql,true).Tables[0];
} 展开
4个回答
展开全部
private void DataBind()
{
string strSql="select distinct p_storeid from p_sales where p_date='081230'";
comboBox1.DataSource=this.SqlGetDataSet(strSql,true).Tables[0];
comboBox1.DataBind();//这绑定下
}
comboBox1_SelectedIndexChanged这个事件里你调用自身的绑定?
设置好DataSource,后要DataBind();下
{
string strSql="select distinct p_storeid from p_sales where p_date='081230'";
comboBox1.DataSource=this.SqlGetDataSet(strSql,true).Tables[0];
comboBox1.DataBind();//这绑定下
}
comboBox1_SelectedIndexChanged这个事件里你调用自身的绑定?
设置好DataSource,后要DataBind();下
展开全部
前台
<asp:DropDownList id="combobox1" runat="server" AutoPostBack="True" onselectedindexchanged="ddlrefectory_SelectedIndexChanged"/>
要加AutoPostBack="True"
后台要写绑定列
this.combobox1.DataTextField="列名";
this.combobox1.DataValueField="列名";
this.combobox1.DataBind();
不明白在问我吧
<asp:DropDownList id="combobox1" runat="server" AutoPostBack="True" onselectedindexchanged="ddlrefectory_SelectedIndexChanged"/>
要加AutoPostBack="True"
后台要写绑定列
this.combobox1.DataTextField="列名";
this.combobox1.DataValueField="列名";
this.combobox1.DataBind();
不明白在问我吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
//要绑定列
this.combobox1.DataTextField="列名";
this.combobox1.DataValueField="列名";
//然后再Bind()下
this.combobox1.DataBind();
this.combobox1.DataTextField="列名";
this.combobox1.DataValueField="列名";
//然后再Bind()下
this.combobox1.DataBind();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2009-01-04
展开全部
1,2楼在忽悠人
首先检查一下你的SQL语句真的查询到数据了吗
private void DataBind()
{
string strSql="select distinct p_storeid from p_sales where p_date='081230'";
comboBox1.DataSource=this.SqlGetDataSet(strSql,true).Tables[0];
comboBox1.DisplayMember = "p_storeid";
comboBox1.ValueMember = "p_storeid";
}
首先检查一下你的SQL语句真的查询到数据了吗
private void DataBind()
{
string strSql="select distinct p_storeid from p_sales where p_date='081230'";
comboBox1.DataSource=this.SqlGetDataSet(strSql,true).Tables[0];
comboBox1.DisplayMember = "p_storeid";
comboBox1.ValueMember = "p_storeid";
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询