Student Management System (2)

Source: Internet
Author: User

Function.

This part allows you to learn a lot of technical things, especially the problems with the interaction between programs and databases, because the code is basically repeated and is "add, delete, modify, and query ". let's talk about your problems.

Question 1:

Adlockoptimistic and update, adlockbatchoptimistic and updatebatch.

Because the difference between the two is mixed up, I had a hard time tangle at the beginning.

Question 2:

The above problems occur when you knock on the student information management system are generally caused by database connection problems. You can check statements related to database connection. Remind everyone that in the following process, pay attention to the spaces behind the where!

Private sub cmdinquire_click () dim txtsql as string dim msgtext as string dim dd (4) as Boolean dim objrs as ADODB. recordset txtsql = "select * From result_info where" 'connect database' select student ID if check1 (0 ). value then if trim (txtsid. text) = "" Then msgbox "student ID cannot be blank. Enter a student ID !!! ", Vbokonly + vbexclamation," warning "txtsid. setfocus exit sub else if not isnumeric (TRIM (txtsid. Text) Then msgbox" enter a number !!! ", Vbokonly + vbexclamation," warning "Exit sub txtsid. setfocus txtsid. selstart = 0 txtsid. sellength = Len (txtsid. text) end if dd (0) = true txtsql = txtsql & "student_id = '" & trim (txtsid. text) & "'" end if

Question 3:

The above error occurs mainly because the input length or data type is inconsistent with the database setting. In this way, an error occurs when writing data to the database. To avoid this error, you can display the length and format of user input based on database requirements.

For example, you can only enter numbers. The maximum length is 20.

Public sub lmtlong (txt as string, N as integer) 'limits the input length if Len (TRIM (txt)> = n then keyascii = 0 msgbox "up to" & N !!! ", Vbexclamation + vbokonly," warning "end if end subpublic sub lmtnumber (A as integer) 'can only enter numbers if (a> = 48 and A <= 57) or a = 8 then else a = 0 msgbox "enter a number !! ", Vbokonly + vbexclamation," warning "End ifend Sub Problem 4:

If no record exists in the database, this problem occurs when the database is loaded again. Solution: make a judgment in advance. If the data is empty, the system prompts you to add data.

Private sub modifycoursemenu_click () dim txtsql as string dim msgtext as string dim objrs as ADODB. recordset txtsql = "select * From course_info" set objrs = executesql (txtsql, msgtext) If objrs. EOF and objrs. bof then msgbox "data is empty. Please add data first", vbokonly + vbexclamation, "warning" Exit sub else frmmodifycourseinfo. show sbstatusbar. panels (1) = frmmodifycourseinfo. caption end ifend sub

Question 5:

This problem has been entangled for a long time. When using bookmarks, if you delete the last record, an error will be reported. The solutions are also different from each other. I used the following method at the beginning: To judge. If it is the last record, I will remind you to delete and unmount the form.

If str2 = vbok then if objrs. recordcount = 1 then objrs. Delete msgbox "the record has been completely deleted. Please add information !! ", Vbokonly + vbexclamation," warning "unload me else objrs. movenext if objrs. EOF then objrs. movefirst mybookmark = objrs. bookmark objrs. movelast objrs. delete objrs. bookmark = mybookmark call viewdata else mybookmark = objrs. bookmark objrs. delete objrs. moveprevious objrs. bookmark = mybookmark call viewdata' end if else objrs. bookmark = mybookmark call viewdata end if

 

However, if there are only two data entries in the database at the beginning, Problem 4 still occurs. I have not solved this problem yet. I hope you can give me some advice.

Question 6:

This error occurs when a table is disabled.

Question 7:

Is the data updated directly or is it deleted before being written?

The above problems are some of the main problems encountered during the student management system. Of course, there are certainly more problems. We will discuss other details in the following 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.