cool hit counter Real-time error'91': Object variables orwith Block variable not set_Intefrankly

Real-time error'91': Object variables orwith Block variable not set


Copyright: This is an original post by the blogger and may not be reproduced without the blogger's permission. https://blog.csdn.net/huyuyang6688/article/details/9672911

People are working on the student information management system these days and it appears

The most frequent would be this problem, "Real-time error '91': object variable or with block variable not set". As shown at right.

When we encounter this problem, the first thing we should do is to refer to MSDN, but at this point MSDN doesn't seem to help us a lot, and to summarize, there are actually a number of situations where this error occurs.

1. Before running the program without Configuring the ODBC Data Source Or the ODBC data source is misconfigured, provided of course that SQL Server executes the relevant SQL code (the student.mdb file used in the student system).

2, code problems, most cases are problems with the query statement, such as.

(1)、SQL Less spaces between statements:txtSQL = "select * fromstudent_Info"

(2)、 In the form that performs the query for student registration information, Execute the statementtxtSQL = "select * from result_Info where", Because there are conditions to be added later, So in‘where’ harmony‘ " ’ An error occurs when a space is missing between。

(3)、 In a full query statement, for example txtSQL = "select * from class_Info where class_No='" & Trim(txtClassno.Text) & "'", where in the final judgment of the conditions in the input box, Double quotes and single quotes must be noted( The whole sentence is in three layers of quotation marks from the outside to the inside: double quote, single quote, double quote), Neither must its sequential hierarchy be destroyed, And you can't leave anything behind.。

3, logic error: the lack of statements, after the execution of the statement txtSQL correctly assigned to the value, directly manipulate the data in the database, to put it plainly is not yet connected to the database to operate on it, this is also a mistake I have made. After assigning the value, you directly execute the add, delete, and check of the database, completely leaving the function executeSQl, which calls the judgment and connects to the database, behind.

4, there is also the case of MSDN hints, such as trying to use the object variable has been set to Nothing and so on, here no more, please refer to MSDN for VB6.0 for details


Recommended>>
1、Airdrop lets you get tokens at zero cost
2、A man lying on a bridge at odd hours of the night was hit in the head by an airport bus A driverless ghost car Video shenanigans
3、Data privacy block mining artificial intelligence future world
4、Rens latest internal speech cybersecurity privacy protection to be top company goals
5、OneWeekPop portal OneWeekPop App cargo portal

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号