The code copy is as follows:
'subject information title
'Company's company name
'content's content of posting information
'address company address
'infomation company profile
'note related instructions
All the above values are submitted by FORM, and then the corresponding values are obtained by: subject=trim(Request.Form("subject")) etc.
<%
'This function is very critical! --------------------------------------------------------------------------------------------------------------------------------
Functionsql(a,b,sqls)
ifb<>""then' If the client does not submit this value, the corresponding SQL statement will not be generated.
sqls=sqls&"and"&a&"like'%"&b&"%'"
endif
sql=sqls
EndFunction
'-----------------------------------------------------------------------------------------------------------------------------
Setcon_n=Server.CreateObject("ADODB.Connection")
DBpath=Server.MapPath("/database/mydb.mdb")
Conn.Open"driver={Microsoft AccessDriver(*.mdb)};pwd=;dbq="&DBpath
Setrs=Server.CreateObject("ADODB.Recordset")
sqls="select*frommytablewhere1=1"
'The following calls the above function, and there are many calls (theoretically any)
sqls=sql("subject",subject,sqls)
sqls=sql("company",company,sqls)
sqls=sql("content",content,sqls)
sqls=sql("address",address,sqls)
sqls=sql("infomation",infomation,sqls)
sqls=sql("note",note,sqls)
sqls=sqls&"orderbyiddesc"
rs.opensqls,conn,3,2
%>
[Conclusion]
If there is no key function Functionsql(a,b,sqls), we can imagine how many judgments are needed one after another!