asp简略地搜索引擎代码

下面是库中URLINDEX表:URL和Keywords字段分别添加了索引.

 URL           文本 (索引:有(无重复))
Title            文本
Description 文本
Summary    文本
Keywords   文本(索引:有(无重复))

doquery.ASP

 <HTML><HEAD><TITLE>简单搜索引擎</TITLE></HEAD>
<BODY BGCOLOR=#ffffff MARGINWIDTH="0" MARGINHEIGHT="0"
LEFTMARGIN=0 TOPMARGIN=0>

<FORM METHOD="post" ACTION="doquery.ASP?act=search">
 Query: <INPUT TYPE="Text" NAME="QueryString"><BR>
 <INPUT TYPE="Submit" VALUE="Submit">
</FORM>
</CENTER>

<%
dim act
act=request("act")
if(act="search") then
 QueryString = Request.form( "QueryString" )
 Querywords  = Split( QueryString )
 strIndent   = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
 
 ‘ 如果搜索为空则返回
 If QueryString = "" Then
  Response.Redirect( "default.ASP" )
 End If
 
 Session.timeout = 2
 If IsObject(Session("sitesearch_conn")) Then
     Set conn = Session("sitesearch_conn")
 Else
     Set conn = Server.CreateObject("ADODB.Connection")
     conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("database/SiteSearch.mdb"),"",""
     Set Session("sitesearch_conn") = conn
 End If

 ‘ 查询语句
 sql = "SELECT * FROM [URLIndex] WHERE"
   

 ‘搜索Description字段
 sql = sql & " ( [Description] LIKE ‘%" & Querywords( 0 ) & "%’"   ‘ First
 For i = LBound( Querywords ) + 1 to UBound( Querywords )
  If Querywords( i ) <> "" and UCase( Querywords(i) ) <> "OR" and UCase( Querywords(i) ) <> "AND" Then
   If uCase( Querywords( i-1 ) ) = "OR" Then
    sql = sql & " OR [Description] LIKE ‘%" & Querywords( i ) & "%’"
   Else
    sql = sql & " AND [Description] LIKE ‘%" & Querywords( i ) & "%’"
   End If
  End If
 Next

 ‘ 搜索Keywords字段
 sql = sql & " ) OR ( [Keywords] LIKE ‘%" & Querywords( 0 ) & "%’"
 For i = LBound( Querywords ) + 1 to UBound( Querywords )
  If Querywords( i ) <> "" and UCase( Querywords(i) ) <> "OR" and UCase( Querywords(i) ) <> "AND" Then
   If uCase( Querywords( i-1 ) ) = "OR" Then
    sql = sql & " OR [Keywords] LIKE ‘%" & Querywords( i ) & "%’"
   Else
    sql = sql & " AND [Keywords] LIKE ‘%" & Querywords( i ) & "%’"
   End If
  End If
 Next

 ‘  搜索Title字段 
 sql = sql & " ) OR ( [Title] LIKE ‘%" & Querywords( 0 ) & "%’"
 For i = LBound( Querywords ) + 1 to UBound( Querywords )
  If Querywords( i ) <> "" and UCase( Querywords(i) ) <> "OR" and UCase( Querywords(i) ) <> "AND" Then
   If uCase( Querywords( i-1 ) ) = "OR" Then
    sql = sql & " OR [Title] LIKE ‘%" & Querywords( i ) & "%’"
   Else
    sql = sql & " AND [Title] LIKE ‘%" & Querywords( i ) & "%’"
   End If
  End If
 Next

 ‘ 搜索Summary字段
 sql = sql & " ) OR ( [Summary] LIKE ‘%" & Querywords( 0 ) & "%’"
 For i = LBound( Querywords ) + 1 to UBound( Querywords )
  If Querywords( i ) <> "" and UCase( Querywords(i) ) <> "OR" and UCase( Querywords(i) ) <> "AND" Then
   If uCase( Querywords( i-1 ) ) = "OR" Then
    sql = sql & " OR [Summary] LIKE ‘%" & Querywords( i ) & "%’"
   Else
    sql = sql & " AND [Summary] LIKE ‘%" & Querywords( i ) & "%’"
   End If
  End If
 Next

 sql = sql & " )"

    ‘
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 3, 3    
   
    Response.Write "<BR><B> 你搜索的是: </B> " & QueryString   
   
    Response.Write "<BR><B> 搜索的关键字: </B> "
 For i = LBound( Querywords ) to UBound( Querywords )
  Response.Write "<BR>" & strIndent & i & ": " & Querywords( i )
 Next

    ‘ Print the SQL String
    Response.Write "<BR><B> sql 语句 : </B> " & sql
 
 ‘ Print the Results
    Response.Write "<BR><B> 结果&nbsp;&nbsp;&nbsp;&nbsp;: </B> <UL>"
 On Error Resume Next
 rs.MoveFirst
 Do While Not rs.eof
  Response.Write "<BR>" & "<
A HREF=’OpenPage.ASP?IndexURL=" & rs.Fields("URL").Value & "’>" & rs.Fields("Title") & "</A> – "
  Response.Write rs.Fields("Description") & "<BR>"
  Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT SIZE=2>URL: " & rs.Fields("URL") & "</FONT>"
  Response.Write "<HR SIZE=1 WIDTH=200 ALIGN=LEFT>"
  rs.MoveNext
 Loop
 Response.Write "</UL>"
 
end if  
%>

</BODY>
</HTML>

工单上加版本信息

query:

select
       tisfc001.pdno,         | Production Order
       tisfc001.mitm,         | Item
       tcibd001.citg,         | Item Group
       tisfc001.osta,         | Order Status
       tisfc001.qrdr,         | Quantity Ordered
       tisfc001.qtdl,         | Quantity to Deliver
       tisfc001.qdlv,         | Quantity Delivered
       tisfc001.qrjc,         | Quantity Rejected
       tisfc001.efdt,      |referce date
       tisfc001.prdt,         | Production Start Date and Ti
       tisfc001.dldt          | (Re) Planned Delivery Date
from
       tcibd001,              | General Item Data
       tisfc001               | Production Orders
 |tiedm100
where
       tisfc001.mitm >= tisfc001.mitm.f and
       tisfc001.mitm <= tisfc001.mitm.t and
       tcibd001.citg >= tcibd001.citg.f and
       tcibd001.citg <= tcibd001.citg.t and
       tisfc001.efdt >= tisfc001.efdt.f and
       tisfc001.efdt <= tisfc001.efdt.t and

       tisfc001.mitm = tcibd001.item and
       tisfc001.osta <> tcosta.closed and
       tisfc001.osta <> tcosta.completed
order by
       tisfc001.mitm

report script:

declaration:
 table ttiedm100 |engineering item revisions
 table ttisfc001 |production orders
extern domain tiedm.revi order.revi

Detail.1:
before.layout:
 order.revi = ""
 
 select tisfc001.efdt
 from tisfc001
 where tisfc001.pdno = :tisfc001.pdno
 selectdo
 endselect 
 select tiedm100.revi
 from tiedm100
 where tiedm100.eitm = :tisfc001.mitm and
  tiedm100.indt <= :tisfc001.efdt and
  (tiedm100.exdt >= :tisfc001.efdt or tiedm100.exdt = 0)
 selectdo
  order.revi = tiedm100.revi
 selectempty
 endselect

EXCEL 自定义菜单

Sub XXXscrap()

Dim XXX As CommandBarPopup
Dim scrap As CommandBarPopup
Dim about As CommandBarControl

Dim finderror As CommandBarControl
Dim cleanup As CommandBarControl
Dim updatascrap As CommandBarControl

‘菜单栏出现公司名称
Set XXX = Application.CommandBars("Worksheet Menu Bar").Controls.Add(Type:=msoControlPopup)
XXX.Caption = "XXX公司"

‘点击XXX公司,出现两个子项
Set scrap = XXX.CommandBar.Controls.Add(Type:=msoControlPopup)
scrap.Caption = "Scrap"

Set about = XXX.CommandBar.Controls.Add(Type:=msoControlButton, ID:=2950)
about.Caption = "About"
about.OnAction = "abouttony"

‘点击scrap,出现三个子项
Set cleanup = scrap.CommandBar.Controls.Add(Type:=msoControlButton)
cleanup.Caption = "Clean up data"
cleanup.OnAction = "cleanuptony"

Set finderror = scrap.CommandBar.Controls.Add(Type:=msoControlButton)
finderror.Caption = "Find error data"
finderror.OnAction = "finderrortony"

Set updatascrap = scrap.CommandBar.Controls.Add(Type:=msoControlButton)
updatascrap.Caption = "Updata Scrap"
updatascrap.OnAction = "updatascraptony"

End Sub

bat 备份文件,上传文件

文件1:

ftp  -n  -s:"upload.txt"
call upload_bankup_rename.bat

文件2:upload.txt

Open 192.168.1.1
User username password
Cd /as3t/exp_imp/C162/scrap
Bin
Prompt
mput E:escraptesttransfer.csv
mput E:escraptestadjust.csv
bye

文件3:upload_bankup_rename.bat

rem 获取当前日期和时间
set bak_date=%date:~0,4%%date:~5,2%%date:~8,2%
set bak_time=%time:~0,8%
set bak_time=%bak_time::=%
cd E:escraptest
rem 重命名备份至另外的文件夹
IF EXIST transfer.csv Ren transfer.csv  %bak_date%_%bak_time%_transfer_local.csv
xcopy %bak_date%_%bak_time%_transfer_local.csv E:escrapbatbankup_
del %bak_date%_%bak_time%_transfer_local.csv
IF EXIST adjust.csv Ren adjust.csv  %bak_date%_%bak_time%_adjust_local.csv
xcopy %bak_date%_%bak_time%_adjust_local.csv E:escrapbatbankup_
del %bak_date%_%bak_time%_adjust_local.csv