I often encounter this situation when I as an ASP program:
Column data in the database (such as all employee names) is listed in the list box, and the program requirements select one or more of the submitted to the next page.
But trouble is that if data (such as employees) will bring trouble to customers - to be positioned from a long list. The best solution is that the user performs data positioning in the way before choosing a fuzzy query, accurately identify the employee name, then select, and submit it.
The problem appears in front of our programmer: How to filter data from the database without refreshing the page filtering from the database. There are two kinds of methods:
1. Methods with dual list boxes
2, use XML method
This article mainly introduces the first method: method of using a dual list box
Programming ideas:
With a dual list box, one is a hidden state and the other is a list box that is displayed to the user.
The program begins to put data (such as employee name) into two list boxes.
This enables the content that does not refresh the new page filtering the database.
achieve:
The following is an example of SQL Server, and the employee name of the Employees table in the Northwind library will be filtered.
script>
<% servername = "WYB" server name user = "sa" username PW = "" "user password DatabaseName =" northwind " Database name set conn = server.createObject ("adodb.connection") conn.open "Driver = SQL Server; Server =" & ServerName & "; UID =" & User & "; PWD =" & PW & "; Database =" & DatabaseName Set RS = Server .CreateObject ("adodb.recordset") SQL = "SELECT EMPLOYEES ORDER BY EMPLOYEEID" rs.open sql, conn%>td> tr> < Tr> | Query Results |