Experiment 5 Programming for students, selection, and simple management system
One. Purpose
1. By programming the extension example program "Student Selection System" function.
2. Further grasp the basic steps and methods of the debugging process.
two. Experimental requirements
1. Make students, teachers and curriculums have the function of adding, modifying, deleting and querying data.
2. Students choose less based on the course.
3. Teachers are logged in according to the students selected.
4. Various statistical analysis.
5. Other auxiliary functions.
three. Experimental report requirements
1. systems mannual.
2. Program script.
3. Commissioning report.
4. Experience.
systems mannual:
The system is student, electing lessons, and a simple management system. Complete students through the student number, password, course number class and returning class, and the teacher through password maintenance of student watch, curriculum, and landing grades.
Program script:
--------------------Main interface--------------------
// Query button
IF SLE_1.TEXT = "" "" "
MessageBox ("error", "Please enter the school number!")
Else
SLE_1.TEXT = Upper (SLE_1.TEXT)
IF TRIM (SLE_1.TEXT) <> TRIM (S_INFO) THEN
S_INFO = SLE_1.TEXT
dw_2.reset ()
DW_2.SetTransObject (SQLCA)
DW_2.Retrieve (S_INFO)
dw_2.object.dataWindow.Readonly = "YES"
dw_3.reset ()
DW_3.SetTransObject (SQLCA)
DW_3.Retrieve (S_INFO)
Dw_3.object.dataWindow.readOnly = "YES"
END IF
END IF
// Selection button
String CNumber, KK1, KK2, KK3, PWD, TMPPWD
SLE_1.TEXT = Upper (SLE_1.TEXT)
SLE_2.TEXT = Upper (SLE_2.TEXT)
KK1 = Upper (s_info)
IF TRIM (SLE_1.TEXT) <> TRIM (KK1) THEN
DW_2.SetTransObject (SQLCA)
S_INFO = Trim (SLE_1.TEXT)
DW_2.Retrieve (S_INFO)
dw_2.object.dataWindow.Readonly = "YES"
DW_3.SetTransObject (SQLCA)
DW_3.Retrieve (S_INFO)
Dw_3.object.dataWindow.readOnly = "YES"
END IF
IF SLE_2.TEXT = "" OR SLE_3.TEXT = "" THEN
MessageBox ("Error", "Enter the Entry Courser and Password!")
END IF
IF SLE_2.TEXT <> "" "" ""
PWD = SLE_3.TEXT
SELECT Password Into: TMPPWD from
WHERE S.SNO =: SLE_1.TEXT;
IF PWD = TMPPWD THEN
CNUMBER = SLE_2.TEXT
Select c.cname Into: kk2 from c where c.cno =: cnumber;
IF kk2 = "" "
MessageBox ("Error", "This course does not exist!") End IF
Select sc.cno Into: KK3 from sc. =: SLE_2.TEXT AND SC.SNO =: s_info);
if Sqlca.sqlcode = 0 THEN
MessageBox, "This course is selected!")
Else
INSERT INTO SC (SNO, CNO) VALUES (: s_info,: sle_2.text);
END IF
dw_2.reset ()
SLE_2.TEXT = ""
DW_2.SetTransObject (SQLCA)
DW_2.Retrieve (S_INFO)
dw_2.object.dataWindow.Readonly = "YES"
Else
MessageBox ("Error", "Password Error!")
END IF
END IF
// Returned button
String CNumber, KK1, KK2, KK3, PWD, TMPPWD
SLE_1.TEXT = Upper (SLE_1.TEXT)
SLE_2.TEXT = Upper (SLE_2.TEXT)
KK1 = Upper (s_info)
IF TRIM (SLE_1.TEXT) <> TRIM (KK1) THEN
DW_2.SetTransObject (SQLCA)
S_INFO = Trim (SLE_1.TEXT)
DW_2.Retrieve (S_INFO)
dw_2.object.dataWindow.Readonly = "YES"
DW_3.SetTransObject (SQLCA)
DW_3.Retrieve (S_INFO)
Dw_3.object.dataWindow.readOnly = "YES"
END IF
IF SLE_2.TEXT = "" OR SLE_3.TEXT = "" THEN
MessageBox ("error", "Please enter the course number and password!")
END IF
IF SLE_2.TEXT <> "" "" ""
PWD = SLE_3.TEXT
SELECT Password Into: TMPPWD from
WHERE S.SNO =: SLE_1.TEXT;
IF PWD = TMPPWD THEN
CNUMBER = SLE_2.TEXT
Select c.cname Into: kk2 from c where c.cno =: cnumber;
IF kk2 = "" "
MessageBox ("error", "This course does not exist!")
END IF
Select sc.cno Into: KK3 from sc. =: SLE_2.TEXT AND SC.SNO =: s_info);
if Sqlca.sqlcode = 0 THEN
MessageBox ("Error", "Do not choose this course!")
Else
INSERT INTO SC (SNO, CNO) VALUES (: s_info,: sle_2.text);
END IF
dw_2.reset ()
SLE_2.TEXT = ""
DW_2.SetTransObject (SQLCA)
DW_2.Retrieve (S_INFO)
dw_2.object.dataWindow.Readonly = "YES"
ElseMessageBox ("Error", "Password Error!")
END IF
END IF
// Close button
Close (PARENT)
-------------------- Student Table and Course Table Interface --------------------
Its code is consistent with the book
------------------------------------------
// Save button
Int TT, Hascol
String KK, GRADE
Tt = dw_1.getrow ()
S_INFO = SLE_1.TEXT
C_INFO = SLE_2.TEXT
Grade = SLE_3.TEXT
Update sc set grade =: SLE_3.TEXT WHERE (sc.SNO =: s_info and sc.cno =: c_info);
IF s_info = kk and pb_1.enabled = false kil
MessageBox ("error", "This student has existing!")
Else
dw_1.update ()
Hascol = dw_1.retrieve ()
ST_2.Text = String (Hascol)
END IF
Debug report:
Debug is not encountered by a syntax error, encountered a problem that variable undefined. There is no problem.
In the machine:
This experiment is based on experimental four. Add some other features on the basis of the experiment, such as: statistics and modifications of grades, need to pass a password, manage student watch, curriculum, and transcripts, teachers need to log in. And the password is not written in the program, and it is placed in the database table. It is considered to be difficult, but after a period of PB practice, it is more mastered to the PB, and the SQL statement is more mastered. Did not spend how much time is realized The function of imagining. The relevant experiments to this PB have been completed, and there is a lot of secondary schools, and will continue to study in the future.