end if sValue = inv_string.of_globalreplace(sValue,"'","") //去掉sValue中的单引号. sValue = inv_string.of_globalreplace(sValue,'"','') //去掉sValue中的双引号. sValue = inv_string.of_globalreplace(sValue,")","") //去掉sValue中的右括号. sLog = GetItemString(i,"logical") if sLog = "" or isNull(sLog) then sLog = "and" dw_where.SetItem(i,"logical","and") end if ywcol = wf_getYwName(hzcol) //表名.列名 sType = lower(wf_getYwType(hzcol)) CHOOSE CASE sType CASE "char","character","string","nchar","nvarchar","varchar","time" if trim(sOper) = "like" or trim(sOper) = "not like" then sWhere += " (" + sLeft_kh + ywcol + sOper + "'%" + sValue + "%') " + sRight_kh + sLog else sWhere += " (" + sLeft_kh + ywcol + sOper + "'" + sValue + "') " + sRight_kh + sLog end if CASE "numeric","decimal","decimaln","dec","double","integer","int","smallint",& "number","long","real","uint","ulong","unsignedint","unsignedinteger","unsignedlong" if trim(sOper) = "like" or trim(sOper) = "not like" then if MessageBox("提示信息",hzcol + "不是字符型,不能使用<含有>或<不含有>操作符," + & "~r~n~r~n请改正; 否则,所有查询条件将被忽略。",None!,OKCancel!,2)=1 then return 1 else dw_where.setfocus() return 0 end if end if if isNumber(sValue) then sWhere += " (" + sLeft_kh + ywcol + sOper + sValue + ") " + sRight_kh + sLog else if MessageBox("综合查询输入错误",hzcol + "的值应为数字型,请改正;" + & "~r~n~r~n否则,所有查询条件将被忽略。",None!,OKCancel!,2)=1 then Return 1 else dw_where.setfocus() return 0 end if end if CASE "date","datetime","datetimn","smalldatetime","timestamp" if trim(sOper) = "like" or trim(sOper) = "not like" then if MessageBox("提示信息",hzcol + "不是字符型,不能使用<含有>或<不含有>操作符," + & "~r~n~r~n请改正; 否则,所有查询条件将被忽略。",None!,OKCancel!,2)=1 then return 1 else dw_where.setfocus() return 0 end if end if if sType = "date" then if not isdate(sValue) then if MessageBox("综合查询输入错误",hzcol + "的值应为日期型,请改正;" + & "~r~n~r~n否则,所有查询条件将被忽略.",None!,OKCancel!,2)=1 then Return 1 else dw_where.setfocus() return 0 end if end if sValue = wf_dateconvert(sValue) sWhere += " (" + sLeft_kh + ywcol + sOper + "'" + sValue + "') " + sRight_kh + sLog else //datetime型的字段在sybase中转换为字符串的类型 sValue = wf_datetime(sValue) if sValue = "error" then if MessageBox("综合查询输入错误",hzcol + "的值应为日期时间型,请改正;" + & "~r~n~r~n否则,所有查询条件将被忽略。",None!,OKCancel!,2)=1 then Return 1 else dw_where.setfocus()