Student Information Management System (5)-add, delete, modify, query, and student information management system

Source: Internet
Author: User

Student Information Management System (5)-add, delete, modify, query, and student information management system
The student information management system is a set of additions, deletions, modifications, and queries. Next we will analyze them separately.1. Add(Add a record, taking the frmAddclassinfo form as an example)
First, make sure that the text boxes cannot be empty.Use the custom function Testtxt in the module to check whether the text box is empty. If it is empty, a warning is displayed, and the text box gets the focus. For example, the course number cannot be blank.

If Not Testtxt (cboClassNo. Text) Then MsgBox "Enter the shift number! ", VbOKOnly + vbExclamation," warning "cboClassNo. SetFocus cboClassNo. Text =" "Exit Sub End If

Second, the added information cannot be duplicated. 
TxtSQL = "select * from class_Info where class_No = '" & Trim (cboClassNo. text) & "'" Set mrc = ExecuteSQL (txtSQL, MsgText) If Not (mrc. EOF And mrc. BOF) then' make sure the entered class number does not exist MsgBox "Please enter the class number again! ", VbOKOnly + vbExclamation," warning "cboClassNo. SetFocus mrc. Close Else ......

Finally, the record is successfully added.
TxtSQL = "select * from class_Info" Set mrc = ExecuteSQL (txtSQL, MsgText) mrc. addNew mrc. fields (0) = Trim (cboClassNo. text) mrc. fields (1) = Trim (cboGrade. text) mrc. fields (2) = Trim (txtDirector. text) mrc. fields (3) = Trim (cboClassNo. text) mrc. update mrc. close Me. hide MsgBox "class information added successfully! ", VbOKOnly + vbExclamation," add class information "End If
Ii. Delete(FrmModifyclassinfo is used as an example to delete a record .)

Use an MsgBox statement to determine whether to delete a record.
Str2 $ = MsgBox ("Do you want to delete the current record? ", VbOKCancel," delete current record ")
 
OK, delete 

If str2$ = vbOK Then<span style="white-space:pre"></span>mrc.MoveNext        If mrc.EOF Then                  <span style="white-space:pre"></span>mrc.MoveFirst                myBookmark = mrc.Bookmark                mrc.MoveLast                mrc.Delete                mrc.Bookmark = myBookmark                Call viewData        Else                myBookmark = mrc.Bookmark                mrc.MovePrevious                mrc.Delete                         mrc.Bookmark = myBookmark                Call viewData        End If

Cancel, cancel Deletion
<pre name="code" class="vb">Elsemrc.Bookmark=mybookmarkCall viewDataEnd If
 
 
The viewData function is used to assign the current record in the temporary table to each text box. 
 
cboClassNo.Text = mrc.Fields(0)cboGrade.Text = mrc.Fields(1)txtDirector.Text = mrc.Fields(2)txtClassroom.Text = mrc.Fields(3)

3. Modify(Modify a record. Here, frmModifyclassinfo is used as an example .) First, each text box is available when you click Modify record. The view information button is unavailable.
<span style="font-size:18px;">cboClassNo.Enabled=TruecboGrade.Enabled=TruetxtDirector.Enabled=TruetxtClassroom.Enabled=TruecmdFirst.Enabled=FalsecmdPrevious.Enabled=FalsecmdNext.Enabled=FalsecmdLast.Enabled=False</span>

Second, the text boxes cannot be empty, and the information cannot be duplicated, just like adding a record.Modification successful
<Span style = "font-size: 18px;"> mrc. addNewmrc. fields (0) = Trim (comboClassNo. text) mrc. fields (1) = Trim (comboGrade. text) mrc. fields (2) = Trim (txtDirector. text) mrc. fields (3) = Trim (txtClassroom. text) mrc. updateMsgBox "class information modified successfully! ", VbOKOnly + vbExclamation," warning "mrc. Bookmark = mybookmarkCall viewData </span>

Finally, the text boxes are unavailable. The view information button is available.
<span style="font-size:18px;">cboClassNo.Enabled=FalsecboGrade.Enabled=FalsetxtDirector.Enabled=FalsetxtClassroom.Enabled=FalsecmdFirst.Enabled=TruecmdPrevious.Enabled=TruecmdNext.Enabled=TruecmdLast.Enabled=True</span>

Iv. Inquire(Query records .) Here we have two query methods:
(1) Click the first, last, last, and next button to query records.
<Span style = "font-size: 18px;"> the Private Sub sequence first_click () 'record set is moved to the first mrc. moveFirst Call viewDataEnd SubPrivate Sub into last_click () 'Move the record set to the last mrc. moveLast Call viewDataEnd Sub Private Sub extends next_click () 'records are moved to the next mrc. moveNext If mrc. EOF Then mrc. moveFirst End If Call viewDataEnd Sub Private Sub incluprevius_click () 'Move the record set to the previous mrc. movePrevious If mrc. BOF Then mrc. moveLast End If Call viewDataEnd Sub </span>

This query method is suitable for querying a single table with few query records.
(2) Search for the desired data according to the conditions and display the data in sequence in the MSHFlexGrid control.
This query method is suitable for queries with a large number of records and a connection between tables. Query by conditions and sort the query results.


The student information management system in C language, including: basic information of students, display information, addition, deletion, and modification of instant mail 2437254923 @ qqcom

I sent
 
Java program: the student information management system can be used to add, delete, modify, and query functions.

No contact information is left for you. How can I contact you?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.