if(!m_TestDatabase.Open( NULL, // Data source name, // NULL if defined in // DSN below FALSE, // exclusive access, // NOT SUPPORTED , // should always be FALSE FALSE, // TRUE = read only access "ODBC;DSN=MS Access 97 Database" // connect string where DSN= is the data source name // found in ODBC32 utility, UID= is user id, PSW= is password ) { ......... }
{
CDialog::OnInitDialog();
if(!db.OpenEx(_T("DSN=Powersoft Demo DB V6;UID=dba;PWD=sql"), CDatabase::noOdbcDialog ))
{
AfxMessageBox("数据库打开失败");
return FALSE;
}........
}
NULL, // Data source name,
// NULL if defined in
// DSN below
FALSE, // exclusive access,
// NOT SUPPORTED ,
// should always be FALSE
FALSE, // TRUE = read only access
"ODBC;DSN=MS Access 97 Database"
// connect string where DSN= is the data source name
// found in ODBC32 utility, UID= is user id, PSW= is password
)
{
.........
}
在CRecordSet里该如何设置啊?
使用时如:
CDatabase db;
db.Open(...);
CRecordSet rs(&db);
rs.Open(..);