网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.如何增强ASP程序性能(2).
.加快DHTML的一组技巧.
.正则表达式 大杂烩.
.Web网站的错误控制.
.Microsoft 脚本编码器Script Enc.
.使用命名管道访问SQL Server.
.在ASP中自动创建多级文件夹的函数.
.asp模仿 Lotus Notes 的界面程序.
.asp中可以保存参数值的分页代码.
.Access通用-自动替换数据库中的字.
.ASP中有关timeout超时的体会&nbs.
.利用ASP从远程服务器上接收XML数.
.用ASP实现从SQL Server导出数据到.
.好东西,翻页程序,大家可以参考.
.ASP向NT域中加一个用户 .
.用鼠标控制滚动的菜单条!(JavaS.
.关于Adodb.Stream的使用说明.
.session的用法具体解说.
.asp+ 如何跨站抓取页面.
.模仿PHP写的ASP分页 .

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

发表日期:2002-5-12


'组合查询之核心:拼接字符串
'功能:定义查询条件,定义返回集,定义排序方式
'平台: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    

    seaNearTime2 = Request(seaNearTime2)
    
    SQL = SQL & " And TimeNear < '"&seaNearTime2&"'"
    
End If

If seaAppTime11 <> "" Then

    seaAppTime1 = seaAppTime11&"-"&seaAppTime12&"-"&seaAppTime13
    
    SQL = SQL & " And AppTime > '"&seaAppTime1&"'"

End If

If Request(seaAppTime1) <> "" Then

    seaAppTime1 = Request(seaAppTime1)
    
    SQL = SQL & " And AppTime > '"&seaAppTime1&"'"

End If

If seaAppTime21 <> "" Then

    seaAppTime2 = seaAppTime21&"-"&seaAppTime22&"-"&seaAppTime23
    
    SQL = SQL & " And AppTime < '"&seaAppTime2&"'"

End If

If Request(seaAppTime2) <> "" Then

    seaAppTime2 = Request(seaAppTime2)
    
    SQL = SQL & " And AppTime < '"&seaAppTime2&"'"

End If

If Request("seaLastUpdTime1") <> "" Then

//    seaLastUpdTime0 = seaLastUpdTime1&"-"&seaLastUpdTime2&"-"&seaLastUpdTime3
    
    SQL = SQL & " And LastUpdTime > '"&seaLastUpdTime&"'"

End If

If Request(seaLastUpdTime1) <> "" Then

    //seaLastUpdTime0 = Request(seaLastUpdTime0)

    SQL = SQL & " And LastUpdTime > '"&seaLastUpdTime&"'"

End If

If Session("Pop") = "1" Then

    AdminName = Session("UserName")

SQL = SQL & " And (OurSales Like '%"&AdminName&"%' Or nexus Like '%w%') Order By " & Order

Else

Response.Write SQL

SQL = SQL & " Order By "& Order 'Order设定排序方式

End If

'Response.Write SQL

上一篇:构造ConnectionString的方法 人气:13064
下一篇:fso的一些特殊功能 人气:12397
浏览全部查询的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐