State Property Indicates for all applicable objects whether the state of the object is open or closed.ObjectStateEnum Specifies whether an object is open or closed, connecting to a data source, executing a command, or retrieving data.Constant Value Description adStateClosed 0 Indicates that the object is closed. adStateOpen 1 Indicates that the object is open. adStateConnecting 2 Indicates that the object is connecting. adStateExecuting 4 Indicates that the object is executing a command. adStateFetching 8 Indicates that the rows of the object are being retrieved.
recordset.close
判断RecordSet是否打开
if(recordset.IsOpen())
recordset->close();
解决的方法就是在你所有要对表或数据库操作的函数的开始出都要判断一下
数据库或表是否已经打开
//监测dao数据库对象的有效性,并在纪录集对象打开时关闭该记录集
if(!m_pDatabase->IsOpen())
return;
if(!m_pRecordset)
return;
if(m_pRecordset->IsOpen())
m_pRecordset->Close();
Indicates for all applicable objects whether the state of the object is open or closed.ObjectStateEnum
Specifies whether an object is open or closed, connecting to a data source, executing a command, or retrieving data.Constant Value Description
adStateClosed 0 Indicates that the object is closed.
adStateOpen 1 Indicates that the object is open.
adStateConnecting 2 Indicates that the object is connecting.
adStateExecuting 4 Indicates that the object is executing a command.
adStateFetching 8 Indicates that the rows of the object are being retrieved.