Recommended: 10 lines of code to let you say goodbye to the disconnect caused by Arp's evil deeds Many people are surfing the Internet together in the dormitory, and many people use ARP to do evil, which leads to keeping the Internet disconnection. I asked me if there was any solution, so I wrote the following vbs script. My classmate said that I would not get rid of the chat after using it. by
We often encounter multiple query problems, and long SQL statements often make monks confused. Especially when the client part fills in query conditions, it will be even more difficult to use ordinary methods.
The following cleverly uses the identity of where 1=1 (in fact, it's a lot, just let it have a value of TRUE) to solve this problem.
[Summary of text]
'subject Information Title
'company The company name that posted the information
'content The content of the information posted
'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.
| The following is the quoted content: <% 'This function is very critical! -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Function sql(a,b,sqls) if b<> then 'If the client does not submit this value, the corresponding SQL statement will not be generated. sqls=sqls & and & a & like '% & b & %' end if sql=sqls End Function '----------------------------------------------------------------------------------------------------------------------------- Set conn=Server.CreateObject(ADODB.Connection) DBpath=Server.MapPath(/database/mydb.mdb) Conn.Open driver={Microsoft Access Driver (*.mdb)};pwd=;dbq= & DBpath Set rs=Server.CreateObject(ADODB.Recordset) sqls=select * from mytable where 1=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 & order by id desc rs.open sqls,conn,3,2 %> [Conclusion] |
If there is no key function Function sql(a,b,sqls), we can imagine how many judgments are needed one after another!
Share: ASP 3.0 Advanced Programming (34) 7.4.4 Using IIS error pages The content related to the ASP error handling process is to provide IIS with customizable error pages. In fact, this feature is also found in IIS 4.0. But the new ASP built-in object ASPError is easier to use and provides more powerful features. In Chapter 4,