For information query, this function is relatively simple, mainly including querying student status and querying scores. The msflexgrid control is mainly used.
I think dd (4) is a better array of Boolean variables. This variable can only be used as a tag. Select a method to query, select a method, or select multiple methods to query information, and use the DD () tag to record the information.
Previously, I always felt that the Boolean variable was quite simple. I did not expect it to play a major role in the system of student management.
If trim (txtname. Text) = "" then
Msgbox "name cannot be blank", vbokonly + vbexclamation, "warning"
Txtname. setfocus
Exit sub
Else
Dd (1) = true
If dd (0) then
'Locate the records that meet student_id = txtsid and student_name = txtname from the result_info table.
Txtsql = txtsql & "and student_name = '" & txtname. Text &"'"
Else
'Find the record with full student_name = txtname from the result_info table
Txtsql = txtsql & "student_name = '" & txtname. Text &"'"
End if
End if
When a Boolean variable is mentioned, when another numeric value is converted to a Boolean value, 0 is converted to false, while other values are converted to true. When the Boolean value is converted to another data type, false becomes 0, and true becomes-1.
The properties of the textmatrix attribute of the msflexgrid control.
Mshflexgrid. textmatrix (I, j) = string
Indicates setting the text content of line I and column J of mshflexgrid (note that the title is the first line)
STR = mshflexgrid. textmatrix (2, 3)
The text content in the second and third columns of mshflexgrid.
Txtsql = txtsql & "order by student_id"
Set MRC = executesql (txtsql, msgtext)
With myflexgrid
. Rows = 2
. Cellalignment = 4
. Textmatrix (1, 0) = "Exam No"
. Textmatrix (1, 1) = "student ID"
. Textmatrix (1, 2) = "name"
. Textmatrix (1, 3) = "shift no"
. Textmatrix (1, 4) = "Course name"
. Textmatrix (1, 5) = "score"
Do while not MRC. EOF
. Rows =. Rows + 1
. Cellalignment = 4
. Textmatrix (. Rows-1, 0) = MRC. Fields (0)
. Textmatrix (. Rows-1, 1) = MRC. Fields (1)
. Textmatrix (. Rows-1, 2) = MRC. Fields (2)
. Textmatrix (. Rows-1, 3) = MRC. Fields (3)
. Textmatrix (. Rows-1, 4) = MRC. Fields (4)
. Textmatrix (. Rows-1, 5) = MRC. Fields (5)
MRC. movenext
Loop
End