Win7+VS2005
实例:
CDatabase db;
bool b = db.Open("SysLog");//假定数据源已经建立
CRecordset rs(&db);
b = rs.Open(CRecordset::forwardOnly,"select * from \"EventLog\" " );//成功
CStringA str;
rs.GetFieldValue((short)0,str);
rs.Close();
db.Close();
注意:
CDatabase db;
bool b = db.Open("SysLog");//假定数据源已经建立
CRecordset rs(&db);
//b = rs.Open(AFX_DB_USE_DEFAULT_TYPE,"select * from \"EventLog\" " );//异常
b = rs.Open(CRecordset::forwardOnly,"select * from \"EventLog\" " );//成功
//b = rs.Open(CRecordset::forwardOnly," select * from \"EventLog\" " );//报错
rs.Close();
db.Close();
2021年目标:完成新书《闻缺陷则喜》,本博客右上公告有下载、阅读链接。