Author: Xingda Computer technology company (www.study01job.com) Guo Baoli
The reason for this is that the query is simple, but the functionality is not weak. Ideas are as follows:
1. Construct a relatively general window, which is used to construct query conditions. A data window control is placed on the window, where the user can enter content, each input item as a query condition, a different item is connected with or, and is a fuzzy query. Only columns of character type are placed in the data window, and date types and numeric types can be placed individually in a window using a user object.
For example, the Data window has ' name ', ' Job type ', ' Graduate school ' and other columns. Users enter ' Guo ' in ' name ' and choose ' administration ' in ' jobs '; the query criteria that should be generated are:
(XM like ' Guo% ') and (gz = ' 1 ')
That is, all columns that use the Drop-down data window, Checkedbox, RadioButton, DDLB, and so on, form the query criteria with an equal sign. In addition, parentheses are used to connect each condition, which is necessary.
User objects are constructed fairly simply, providing a drop-down list box with a select operator that provides a single row editor for input values. Then write the function in the user object that returns the query criteria based on the user's input, which is the name of the current field.
2, to conduct inquiries. The above operation completes in a separate window, returning the query criteria specified by the user. The next step is how to use the query criteria for data query.
Here we use Setsqlselect to complete the query. The only point to note is that each time you get the SQL statement to the Data window, you should use the character handler function to truncate the WHERE clause, and then concatenate the user-grouped condition as the WHERE clause, then Setsqlselect, Settransobject, Retrieve can be.
The above query procedure is relatively simple, the implementation of no complex programming and design ideas, but because it is a business design a query interface for business operators to be more targeted, the operation of the industry is particularly simple, but the query function is still very strong, and is their daily work the most commonly used query. So, it's still more popular.