Today, we solved a very low-level ASP code bug left over half a year ago.

Source: Internet
Author: User
Tags classic asp

Because I have been engaged in Java and do not understand the VB syntax, I was unable to solve this problem for a day (half a year ago). Later, I did not pay attention to it due to the rush of time, I think of it by accident today and finally solved it.

This problem is encountered when maintaining a very small ASP Website. In fact, it is a classic asp bug: when adding news, an exception is reported when no title image is added to the news page or all news is cleared.

"ADODB. Field error '800a0bcd'

Either BOF or EOF is "true", or the current record has been deleted. The operation required requires a current record ."

There are also many ways to solve this problem on the Internet, except that there is no Rs. bof and Rs. EOF judgment: According to the online method, the corresponding judgment is added to handle the corresponding exception, but after the judgment is added, an exception is reported when the title image of the homepage is not added to the news.

The VB problem code originally embedded in the webpage:

<%
Smallpic = ""
SQL = "select * From Jiuye order by news_id DESC"
Set rs = server. Createobject ("ADODB. recordset ")

Rs. Open SQL, Conn, 1, 1

Rs. movelast

Rscount = Rs. recordcount
Rs. movefirst
%>

<! --- The smallpic field refers to the title image -->

<%
While smallpic = ""
Smallpic = RS ("smallpic ")
Smallpictitle = RS ("news_title ")
Smallpic_id = RS ("news_id ")
Rs. movenext
Wend
%>

The error is still reported in the RS. Open SQL, Conn, line. In fact, the root cause is that while smallpic = "" in this judgment, this judgment is repeated, so that when there is no image, the error will continue to be reported. Delete while smallpic = "" and Wend, and add corresponding exception handling in the original code if Rs. bof and Rs. EOF then ...... Else ...... End if and so on.

In fact, taking a closer look at these codes, this kind of code is very low-level, the level of code writing is also very elementary, it is a mess.

 

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.