检查语法错误 FilterS+="项目名称='"+listBox2.Items[j].ToString()+"'or"; 这个是什么意思 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 应该这样用:名字='aaa' or 年龄=100你的or没有后面的部分 就是想让DATAGRID显示项目名称为LISTBOX2中的值的所有行 DataView dv = ds.Tables["项目表"].DefaultView;int m = listBox2.Items.Count;string FilterS = "";for(int j = 0; j < m; j++){ FilterS+="项目名称='"+listBox2.Items[j].ToString()+"'or";}FilterS = FilterS.Substring(0,FilterS.Length - 2); //将最后一次加的or去掉dv.RowFilter = FilterS;dataGrid1.DataSource = dv; 对上面的问题补充:(你要注意留空格,并减掉最后的'or '字符.Filters+="项目名称='"+listBox2.Items[j].tostring()+"' or "; 你调试出FilterS的结果不就成立吗?我看一般是“项目”前的空格问题————————————————————————————————— 结果为 a or b or 后面没有当然不行了改成 or a or b 试试 1://FilterS+="项目名称='" + listBox2.Items[j].ToString()+"'or";FilterS += "项目名称='" + listBox2.Items[j].ToString() + "' or ";2://FilterS = FilterS.Substring(0,FilterS.Length - 2); FilterS = FilterS.Remove(FilterS.Length -4,4); 大家好,我问个字符串格式化的 正则查找 插入用户名,密码,类型时总是提示提交失败。。请高手帮忙看看,谢谢了 存储过程 能根据班级编号求出平均分和排名。 gridview帮定的列的可视=false 那么该列的值就不能获得咱们办? 用TableAdapter插入数据到SqlServer数据库后,怎样获取自增型的ID? 新手求帮忙。。。 c#用类作属性时是否是实例化 c#操作xml 用 HttpListener 做web服务器,输出html,如何让html中外调的css和js起作用? 如何得到当前的时间? new 和override 到底有什么区别啊 ,初学者感谢你们
名字='aaa' or 年龄=100
你的or没有后面的部分
int m = listBox2.Items.Count;
string FilterS = "";
for(int j = 0; j < m; j++)
{
FilterS+="项目名称='"+listBox2.Items[j].ToString()+"'or";
}
FilterS = FilterS.Substring(0,FilterS.Length - 2); //将最后一次加的or去掉
dv.RowFilter = FilterS;
dataGrid1.DataSource = dv;
Filters+="项目名称='"+listBox2.Items[j].tostring()+"' or ";
后面没有当然不行了
改成 or a or b 试试
FilterS += "项目名称='" + listBox2.Items[j].ToString() + "' or ";2://FilterS = FilterS.Substring(0,FilterS.Length - 2);
FilterS = FilterS.Remove(FilterS.Length -4,4);