组合查询之核心:拼接字符串

2016-01-29 18:34 25 1 收藏

组合查询之核心:拼接字符串,组合查询之核心:拼接字符串

【 tulaoshi.com - ASP 】

  '组合查询之核心:拼接字符串
'功能:定义查询条件,定义返回集,定义排序方式
'平台:Windows 2000 Server + IIS5.0 + SQL Server 2000
'语言:VBScript
'作者:Cheery_Ke
'***********Start************
'**************读取变量*************
.
.
.
seaLastUpdTime = Request("seaLastUpdTime1")&"-"&Request("seaLastUpdTime2")&"-"&Request("seaLastUpdTime3")

returnItem = Request("ReturnItem")'******个人设定要返回的字段

'Response.Write returnItem

'***********拼接字符串***************************

If returnItem < "" Then

SQL = "Select ComID,ComName, " & returnItem & " From ClientInfo Where ISInva = 0"

Else

SQL = "Select ComID,ComName From ClientInfo where IsInva = 0"

End If

If seaComName < "" Then

    SQL = SQL & " And ComName Like '%"&seaComName&"%'"

End If

If seanexus1 < "" Then

    SQL = SQL & " And nexus like '%"&seanexus1&"%'"
    
End If

If seanexus2 < "" Then

    SQL = SQL & " And nexus like '%"&seanexus2&"%'"
    
End If

If seaComType < "" Then

    SQL = SQL & " And ComType = '"&seaComType&"'"

End If

If seaComProv < "" Then

    SQL = SQL & " And ComProv = '"&seaComProv&"'"

End If

If seaTimeFrist11 < "" Then

    seaTimeFrist1 = seaTimeFrist11&"-"&seaTimeFrist12&"-"&seaTimeFrist13
    
    SQL = SQL & " And TimeFrist '"&seaTimeFrist1&"'"

End If

If Request(seaTimeFrist1) < "" Then

    seaTimeFrist1 = Request(seaTimeFrist1)
    
    SQL = SQL & " And TimeFrist '"&seaTimeFrist1&"'"

End If

If seaTimeFrist21 < "" Then

    seaTimeFrist2 = seaTimeFrist21&"-"&seaTimeFrist22&"-"&seaTimeFrist23

    SQL = SQL & " And TimeFrist < '"&seaTimeFrist2&"'"

End If

If Request(seaTimeFrist2) < "" Then

    seaTimeFrist2 = Request(seaTimeFrist2)

    SQL = SQL & " And TimeFrist < '"&seaTimeFrist2&"'"

End If

If seaNearTime11 < "" Then

    seaNearTime1 = seaNearTime11&"-"&seaNearTime12&"-"&seaNearTime13
    
    SQL = SQL & " And TimeNear '"&seaNearTime1&"'"

End If

If Request(seaNearTime1) < "" Then

    seaNearTime1 = Request(seaNearTime1)
    
    SQL = SQL & " And TimeNear '"&seaNearTime1&"'"

End If

If seaNearTime21 < "" Then    

    seaNearTime2 = seaNearTime21&"-"&seaNearTime22&"-"&seaNearTime23
    
    SQL = SQL & " And TimeNear < '"&seaNearTime2&"'"
    
End If

If Request(seaNearTime2) < "" Then    

&nb

来源:http://www.tulaoshi.com/n/20160129/1506412.html

延伸阅读
Delphi中的字符串 ——摘自网络 一:各种字符串  字符串是Object Pascal所有数据类型中最有用的类型。许多函数以字符串为传递参数。由于在Delphi中字符串的定义和使用有各种方式,包括Pascal中典型的字符串(String),Delphi支持的长字符串(ANSIString),类似于C语言的字符数组(Array of Char),指向字符的...
标签: Web开发
a href="1.htm"251/a 怎么用JS把251替换为 span style='background-color: #99FF99'251/span [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
SELECT   SUBSTR (T.RPT_ID,                 INSTR (T.RPT_ID,',',1,C.LV)+ 1,                 INSTR (T.RPT_ID,',',1,C.LV + 1)- (INSTR (T.RPT_ID,',',1,C.LV)+ 1)) &n...
标签: ASP
  '*************测字符串长度************** Function CheckStringLength(txt) txt=trim(txt) x = len(txt) y = 0 for ii = 1 to x if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) 255 then '如果是汉字 y = y + 2 else y = y + 1 end if next CheckStringLength = y End Function '************* 截取字符串 ************** f...
字符串的近似匹配,就是答应在匹配时有一定的误差,比如在字串“以前高手好久不见”中找“以前是高手”也能成功。具体地说,错误可以有三种类型:加字符(以前也是高手)、漏字符(以前高手)和替换字符(以前石膏手)。下面的函数在text中查找子串pat,最多答应有k个错误。返回的是匹配的终点(我还没想好如何确定起点,呵呵)。 至于...

经验教程

192

收藏

83
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部