这句话什么意思啊strFilter = strFilter.Substring(0,strFilter.Length - 5);括号中的?string strFilter = "";if (txt1.Text.Trim() = "")//设置表的过滤条件strFilter += "物料编号 like '%" + txt1.Text.Trim() + "%' and ";if (strFilter =

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/16 09:12:47

这句话什么意思啊strFilter = strFilter.Substring(0,strFilter.Length - 5);括号中的?string strFilter = "";if (txt1.Text.Trim() = "")//设置表的过滤条件strFilter += "物料编号 like '%" + txt1.Text.Trim() + "%' and ";if (strFilter =
这句话什么意思啊strFilter = strFilter.Substring(0,strFilter.Length - 5);括号中的?
string strFilter = "";
if (txt1.Text.Trim() = "")//设置表的过滤条件
strFilter += "物料编号 like '%" + txt1.Text.Trim() + "%' and ";
if (strFilter = "") // 存在查询条件
strFilter = strFilter.Substring(0,strFilter.Length - 5);

这句话什么意思啊strFilter = strFilter.Substring(0,strFilter.Length - 5);括号中的?string strFilter = "";if (txt1.Text.Trim() = "")//设置表的过滤条件strFilter += "物料编号 like '%" + txt1.Text.Trim() + "%' and ";if (strFilter =
substring(截取的起始未知,截取的长度);
之所以在最后要接去掉最后5个是因为查询的条件是不定的,你把查询的输出语句在屏幕上打印出来就晓得是怎么回事儿了,在每个条件的最后都有一个“ and ”长度就是5.
例如:最后动态生成的查询条件就是select * from tableName where 物料编号 like '%XXX%' and ;
这样直接执行肯定是不行的,要把”空格and空格“去掉才可以.
还有一个建议就是,数据库的字段怎么用中文呢,这是个不好的习惯哈.

strFilter = strFilter.Substring(0, strFilter.Length - 5);
strFileter=从strFileter截取 (从 0位开始,截取到strFileter的长度少5的字符的位数)