string sql = "select b.id,b.brandid,m.name,b.priceradio,b.fees,b.costmin,b.costmax,b.re,b.begindate,b.enddate,b.opepid " +
",case b.applyto when 1 then '化学品' when 2 then '耗材' else '未知' end as applyto " +........
if (this.RadioButtonList1.SelectedValue.Equals("1"))
{
sql += "";
}
else
{
}
SQL是gridview绑定数据的,要如何写代码能让运行时‘化学品’,‘耗材’通过RadioButtonList1,的选定,分别显示,求助。
",case b.applyto when 1 then '化学品' when 2 then '耗材' else '未知' end as applyto " +........
if (this.RadioButtonList1.SelectedValue.Equals("1"))
{
sql += "";
}
else
{
}
SQL是gridview绑定数据的,要如何写代码能让运行时‘化学品’,‘耗材’通过RadioButtonList1,的选定,分别显示,求助。
解决方案 »
- 如何将路径设置为客户端绝对路径
- asp net嵌套的datalist里如何实现选中复选框的值
- 为什么不能实现当鼠标离开TextBox1控件输入框时,触发TextChanged事件,在Label1控件上显示已输入TextBox1控件的内容
- 关于图片路径问题
- .net环境部署一急问
- 新建.net高级应用群,一年以上.net经验者入,需回答简单提问:)
- 关于DataList的一个非常郁闷的问题!!!
- 初学菜鸟 代码 与界面 相分离问题,
- 有关于Web安装程序的问题???
- 在asp.net技术中,能否象c#技术一样,有线程和守护程序
- 求MVC中加入WCF的解决方案
- asp.net去除了viewstate方法有那些?
string sql = "select b.id,b.brandid,m.name,b.priceradio,b.fees,b.costmin,b.costmax,b.re,b.begindate,b.enddate,b.opepid " +
",case b.applyto when 1 then '化学品' when 2 then '耗材' else '未知' end as applyto from tb where b.applyto =" + this.RadioButtonList1.SelectedValue;
if(rdbtn化学品.Checked==true)
{
sql+="";
}
{
string sql = "select b.id,b.brandid,m.name,b.priceradio,b.fees,b.costmin,b.costmax,b.re,b.begindate,b.enddate,b.opepid ...from talbe_name1 as b,table_name2 as a where a.brandid=b.brandid and brandname='化学品'....
dataset ds=......
gridview1.datasource=ds;
gridview1.databind();
}
else
{
string sql = "select b.id,b.brandid,m.name,b.priceradio,b.fees,b.costmin,b.costmax,b.re,b.begindate,b.enddate,b.opepid ...from talbe_name1 as b,table_name2 as a where a.brandid=b.brandid and brandname='化学品'....
dataset ds=......
gridview1.datasource=ds;
gridview1.databind(); }
直接通过下拉框的选择来决定sql语句的写法,然后执行查询,根据不同条件的查询把返回结果绑定到gridview控件
wangzhi0321
的方法管用,不过写起来麻烦啊