Either Asp.net BOF or EOF is true or the current record has been deleted

Source: Internet
Author: User

We need to use the recordsetcount attribute to determine whether the data in the database is empty before using movenext and other methods of the recordset object: CopyCodeThe Code is as follows: dim objrs as new recordset
Dim objcn as new connection
Dim strsql as string
Objcn. connectionstring = "filedsn = student. DSN; user_id = sa; Password = 123"
Objcn. Open
Strsql = "select * From student_info"
Objrs. Open strsql, objcn, adopenkeyset, adlockoptimistic
'In this case, if it is null, the user will be notified and the operation will be performed to exit the module.
If objrs. recordsetcount = 0 then
Msgbox "Student Status information does not exist. Please add the information before proceeding! "
Objrs. Close
Set objrs = nothing
Do not forget to exit sub. Otherwise, an error is reported because the operation is still performed later.
End if (){
}

In this way, we can solve this problem and continue the subsequent operations. If we write a function that links to the database and returns the record to the recordset, we can skip this step!

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.