In general, the combined query of the data room charging system is to find the information under one or more conditions. If the information is found, it is displayed. If the information is not found, a prompt is displayed. It is always simple. It is not as easy to analyze as you do now. Load in the form according to the program running order: Add drop-down items and set the Editable Interface Box to make MSFlexGr
In general, the combined query of the data room charging system is to find the information under one or more conditions. If the information is found, it is displayed. If the information is not found, a prompt is displayed. It is always simple. It is not as easy to analyze as you do now. Load in the form according to the program running order: Add drop-down items and set the Editable Interface Box to make MSFlexGr
In general, the combined query of the data room charging system is to find the information under one or more conditions. If the information is found, it is displayed. If the information is not found, a prompt is displayed. It is always simple. It is not as easy to analyze as you do now.
Run the program in sequence.
Form loading:
Add a drop-down item to edit the Interface Box and display the title of the MSFlexGrid control.
Combination interface:
When a form is loaded, only the first line is operable. What should I do if I want to perform the following operations?
This requires you to use code to edit the composite combo. If there is content in the composite relationship, the corresponding next row can be operated, and the two rows will generate a composite relationship during query. The same applies to the third row.
The basic information of students is maintained. The database table involved is the Student table, that is, the Student table.
The drop-down items added to the field name combo box are all in Chinese. If you want to search as a condition, it must be recognized by the database. Therefore, a function is required to map each Chinese content in the field name combo box to the English words of the field name in the database. Similarly, the Chinese content in the composite relationship combo box also needs to define a function into a language that can be recognized by databases and computers.
For example, the link combo box:
'Define a function to convert the combination of Chinese characters into computer languages, and the database can recognize them. Private Function GetString (logiczuhe As String) As String Select Case logiczuhe Case "or" 'when the content of the input box is or, it indicates that the Text attribute of the combo box is passed in after the Function change, "or" GetString = "or" Case "and" GetString = "and" End SelectEnd Function
Finally, let's look at the layer-3 relationship.
It is divided into three layers.
If the field names of the second and third rows cannot be edited.
We ensure that the content of all conditions in the first line cannot be blank.
Define an SQL statement, add all the conditions selected on the interface to the SQL statement, and then execute this SQL statement
Traverse the Student table to see if there is any content that matches the statement.
If no,
In this case, all content in the first line is cleared, and the focus is on the first box to be entered. Wait for a new input.
If
Use a loop statement to display each satisfied record to the MSFlexGrid control.
At this time, our first-level query is over.
If you select the combo box of the first composite relationship, the second row is editable.
This is a judgment. If the field name in the third row cannot be edited
Ensure that the content of the first and second rows cannot be blank.
Define an SQL statement, and add the conditions of the first row, the conditions of the second row, and the combination of the conditions of the two rows to the SQL statement used to query information from the Student table. Then execute the SQL statement
Traverse the Student table to check whether the statement content is correct.
If no,
A prompt is displayed. You do not need to clear all information boxes.
If
Use a loop statement to display the records that meet the conditions of the two rows to the MSFlexGrid control, and the two-layer query ends.
The difference between the layer-3 query is that the SQL statement contains one more row of conditions that must be met.
The other two layers are similar.
With the idea, most of the Code is repeated. Sometimes we may feel a mess when analyzing the Code. At this time, we should learn to communicate and tell our own ideas to our classmates, masters, through such communication, we may be able to reap the result of making ourselves clear. Patient analysis is a process that requires meditation.