The second Internet Guide: Class records, or that they expect to apply some "query interface" to create and run queries, SQL databases without having direct application. This article demonstrates the use of ASP performance filter out the records to establish the interface to select a trick. Although the discussion of the settlement where the trick is quite simple, but the application did not result in similar performance of complex queries of any WebPAGE help do the job. Solution for any tips before coding, you should fully understand and record the end-user needs. For this example, the user requires the ability to use the specified types of tricks to get the specified name ... Body:
First, note
Most end users of their Web solutions require some kind of report can help do the job.Application of static Web pages and, no result is very simple to help record and are listed in the table one by one view of their competence. However, users often require that after a drop-down list box (or other selection method) to select a specific category of records, or that they expect to apply some "query interface" to create and run queries, SQL databases without having direct application. This article demonstrates the use of ASP performance filter out the records to establish the interface to select a trick. Although the discussion of the settlement where the trick is quite simple, but the application did not result in similar performance of complex queries of any WebPAGE help do the job.
Solution for any tips before coding, you should fully understand and record the end-user needs. For this example, the user requires the ability to use the specified class name specified in the table to get the hang of a group of records, he had not the type of results did not select all results select a specific category. That feature is there, we apply a the "recursive" ASPPAGE, it has helped select the form contains the category from the list, according to the data extraction form to send the results of the record set, the result will be recorded in the form of table appears to facilitate the user to look.
Second, the structure required to filter out
For the practical application of such a database should first understand the database table involved in the necessary framework and connect to the database connection parameters. Tips connection parameters specified in Microsoft's ASP online documentation has a very detailed description, the paper will not repeat them. In this case to use two tables for the: Document_Category, it contains for the user to select a category name Category_Name; Documents, which contains the names corresponding to other data types, fields, including Category_Name, File_Name, Comments, Date_Submitted and so on.
Select the category list in the form table from the category of Category_Name Document_Category field, constructed type drop-down list box below, please note that there use to VBScript ADO contains documentation:
<%
ConnString = "DSN = LocalUpload;"
Set conn = server. CreateObject ("ADODB.Connection")
conn.Open ConnString,,, adOpenForwardOnly
Set rs = SERVER.CreateObject ("ADODB.Recordset")
'First get used to populate the drop-down list box the type of record
'Set the SQL database statement
database strSQL = "SELECT * FROM Document_Category ORDER BY category_title"
database rs.Open strSQL, conn, adOpenStatic
%>
Function getFilter (listitem) {
var object = "";
var listValue = getListValue (listitem);
document.formCategory.submit (listValue);
}
Function getListValue (list) {
var listValue = "";
if (list.selectedIndex! = -1) {
listValue = list.options [list.selectedIndex]. value;
}
rechanging (listValue);
}
SCRIPT>
Fourth, there results
The last thing it is to construct a query and query results appear. First, construct a query depends on the user selected in the drop-down list box, the category name, that only a simple query the database SQL SELECT statement, the WHERE clause to specify the user selected categories. No results after a query is constructed to run it, and if the record does not meet the requirements, the emergence of a prompt to the user message; otherwise appear in this part of the record. The following is the completion of these tasks VBSCript source code:
<%
If Request.QueryString ("qryCategory") = "" Then
Response.Write ("Please select from the list of a class.")
Else
'Construct the query
Set rs = SERVER.CreateObject ("ADODB.Recordset")
'Set the SQL database statement
database strSQL = "SELECT Documents.File_Name, Documents.Comments,"
Database database = strSQL strSQL & "Documents.Date_Submitted"
Database database = strSQL strSQL & "FROM Documents"
Database database = strSQL strSQL & "WHERE ((Documents.Category_Name) = '" _ &
Request.QueryString ("qryCategory") & "')"
'Open Recordset object
database rs.Open strSQL, conn, adOpenStatic
If rs.RecordCount = 0 Then
Response.Write ("did not invent the specified types of record" & _
Request.QueryString ("qryCategory"))
Else
Response.Write ("
Request.QueryString ("qryCategory") & " H3>")
'Query results appear in the table
Response.Write ("")
Most end users of their Web solutions require some kind of report can help do the job.Application of static Web pages and, no result is very simple to help record and are listed in the table one by one view of their competence. However, users often require that after a drop-down list box (or other selection method) to select a specific category of records, or that they expect to apply some "query interface" to create and run queries, SQL databases without having direct application. This article demonstrates the use of ASP performance filter out the records to establish the interface to select a trick. Although the discussion of the settlement where the trick is quite simple, but the application did not result in similar performance of complex queries of any WebPAGE help do the job.
Solution for any tips before coding, you should fully understand and record the end-user needs. For this example, the user requires the ability to use the specified class name specified in the table to get the hang of a group of records, he had not the type of results did not select all results select a specific category. That feature is there, we apply a the "recursive" ASPPAGE, it has helped select the form contains the category from the list, according to the data extraction form to send the results of the record set, the result will be recorded in the form of table appears to facilitate the user to look.
Second, the structure required to filter out
For the practical application of such a database should first understand the database table involved in the necessary framework and connect to the database connection parameters. Tips connection parameters specified in Microsoft's ASP online documentation has a very detailed description, the paper will not repeat them. In this case to use two tables for the: Document_Category, it contains for the user to select a category name Category_Name; Documents, which contains the names corresponding to other data types, fields, including Category_Name, File_Name, Comments, Date_Submitted and so on.
Select the category list in the form table from the category of Category_Name Document_Category field, constructed type drop-down list box below, please note that there use to VBScript ADO contains documentation:
<%
ConnString = "DSN = LocalUpload;"
Set conn = server. CreateObject ("ADODB.Connection")
conn.Open ConnString,,, adOpenForwardOnly
Set rs = SERVER.CreateObject ("ADODB.Recordset")
'First get used to populate the drop-down list box the type of record
'Set the SQL database statement
database strSQL = "SELECT * FROM Document_Category ORDER BY category_title"
database rs.Open strSQL, conn, adOpenStatic
%>
Function getFilter (listitem) {
var object = "";
var listValue = getListValue (listitem);
document.formCategory.submit (listValue);
}
Function getListValue (list) {
var listValue = "";
if (list.selectedIndex! = -1) {
listValue = list.options [list.selectedIndex]. value;
}
rechanging (listValue);
}
SCRIPT>
Fourth, there results
The last thing it is to construct a query and query results appear. First, construct a query depends on the user selected in the drop-down list box, the category name, that only a simple query the database SQL SELECT statement, the WHERE clause to specify the user selected categories. No results after a query is constructed to run it, and if the record does not meet the requirements, the emergence of a prompt to the user message; otherwise appear in this part of the record. The following is the completion of these tasks VBSCript source code:
<%
If Request.QueryString ("qryCategory") = "" Then
Response.Write ("Please select from the list of a class.")
Else
'Construct the query
Set rs = SERVER.CreateObject ("ADODB.Recordset")
'Set the SQL database statement
database strSQL = "SELECT Documents.File_Name, Documents.Comments,"
Database database = strSQL strSQL & "Documents.Date_Submitted"
Database database = strSQL strSQL & "FROM Documents"
Database database = strSQL strSQL & "WHERE ((Documents.Category_Name) = '" _ &
Request.QueryString ("qryCategory") & "')"
'Open Recordset object
database rs.Open strSQL, conn, adOpenStatic
If rs.RecordCount = 0 Then
Response.Write ("did not invent the specified types of record" & _
Request.QueryString ("qryCategory"))
Else
Response.Write ("
given category contains the following record:" _ &
Request.QueryString ("qryCategory") & " H3>")
'Query results appear in the table
Response.Write ("
Response.Write ("BGCOLOR = # C8C8FF> name B> TD>") Response.Write (" | Response.Write ("BGCOLOR = # C8C8FF> Help B> TD>") Response.Write (" | Response.Write ("BGCOLOR = # C8C8FF> Date B> TD>") Response.Write (" TR>") Do While Not rs.EOF Response.Write (" Response.Write (" " & rs ("File_Name") & " TD>") | Response.Write (" " & rs ("Comments") & " TD>") | Response.Write (" " & rs ("Date_Submitted") & " TD>") | Response.Write (" TR>") rs.MoveNext Loop rs.Close Response.Write (" TABLE>") End If End If Set rs = Nothing conn.Close Set conn = Nothing %> Although in this case we only use a simple WHERE clause of the SQL database with SELECT, but the trick did not score a similar interface and construct complex queries, as long as the corresponding incremental form element used to specify the requirements and The results based on user selected the appropriate SQL database structure statement script. V. Summary ASP performance for end users demand the same data query interface does not help a scalable DEV environment. Full use of the script and did not score a static web page to view and interpretation of data to construct a flexible interface, the user needs some props for the filtered data to help in accordance with a simple but effective tips. |