ASP simple multi-query solution
Copy Code code as follows:
' Subject Information title
' Company name to release information
' Content to post information
' Address Company
' Infomation Company profile
' Note related
The above values are submitted by Form, and then the corresponding values are obtained by: Subject=trim (Request.Form ("subject")).
<%
' This function is critical! ---------------------------
Function SQL (A,B,SQLS)
If b<> "then" if the client does not submit this value, the corresponding SQL statement is not generated.
Sqls=sqls & "and" & A & "Like '%" & B & "%"
End If
Sql=sqls
End Function
'-----------------Call the database
Set con_n=server.createobject ("ADODB. Connection ")
Dbpath=server.mappath ("/database/mydb.mdb")
Conn.Open "Driver={microsoft Access driver (*.mdb)};p wd=;d bq=" & DBPath
Set rs=server.createobject ("ADODB. Recordset ")
Sqls= "SELECT * FROM MyTable where 1=1"
' The following calls the above function, which can be called very many (theoretically arbitrary)
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
%>