使用填充下拉列表的逻辑条件过滤网格视图 [英] filter a gridview using logical conditions that were filled dropdownlist
本文介绍了使用填充下拉列表的逻辑条件过滤网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如:select * from emp where工资< 10000(我在下拉列表中填写<运算符)
使用上面的查询我想在asp.net中显示小于10000的emp名称
解决方案
你可以尝试这个..
string 查询= select * from emp where salary< 1000;
cmd = new SqlCommand(query,con);
da = new SqlDataAdapter(cmd);
dt = new DataTable();
da.Fill(dt);
dropdownList1.DataSource = dt;
dropdownList1.DataValueField = empName;
dropdownList1.DataTextField = empName;
dropdownList1.DataBind();
hii i am newbie to .net programming,i am trying to filter a gridview, using logical conditions that were filled dropdownlist
eg: select * from emp where salary < 10000 (i filled "<" operator in dropdownlist)
using the above query i want to display emp names less than 10000 in asp.net
解决方案
You can try this..
string query = "select * from emp where salary < 1000"; cmd = new SqlCommand(query,con); da = new SqlDataAdapter(cmd); dt = new DataTable(); da.Fill(dt); dropdownList1.DataSource = dt; dropdownList1.DataValueField = "empName"; dropdownList1.DataTextField= "empName"; dropdownList1.DataBind();
这篇关于使用填充下拉列表的逻辑条件过滤网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文