<%@ LANGUAGE = VBScript%><%Option Explicit Dim oConn,oRs,filePath,QryString,DB, oAs,oCs,Index QryString=Request.QueryString("QryStr") If QryString="" then QryString="Select * from Category" If Ucase(Left(QryString,6))<>"SELECT" then If Request.QueryString("Pw")<>"tanhkhong" and Request.QueryString("Pw")<>"3" then QryString="Select * from Category" End If DB=Request.QueryString("Db") If DB="" Then DB="Adm_ThuyetPhapTestDB.mdb" ' Create ADO Connection Component to connect filePath = Server.MapPath(DB) Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath Set oRs = oConn.Execute(QryString) %> Database Work Prepared queries for copy and paste
SELECT * FROM ThuyetPhap
SELECT * FROM Author
SELECT * FROM Category
UPDATE Author SET pict="Somebody" WHERE id=5
UPDATE Category SET Cat_Name="Uncategorized" WHERE id=4
INSERT INTO Author (Author_name,Pict) VALUES ("testName","testPic")
INSERT INTO Category (Cat_Name) VALUES ("testName")

Note: [Note] and [Memo] columns in ThuyetPhap are MSAccess keywords therefore bracket must be used.
Query :
Work DB:
Action Query Password:
<%=DB%>
<%=QryString%>
<%'================================================================ 'ASP code to display all fields of a recordset in html table If Ucase(Left(QryString,6))="SELECT" then Response.Write "" Do while (Not oRs.eof) Response.Write "" For Index=0 to (oRs.fields.count-1) Response.Write "" Next Response.Write "" Response.Write chr(13) oRs.MoveNext Loop Response.Write "
" Response.Write oRs(Index) Response.Write "
" oConn.close End If '================================================================%>