这是我的代码,直接读取数据没有什么问题,数据库是可以update的。
Cmessage *lrecTemp = theApp.GetSet();
if(lrecTemp->IsOpen())
{
AfxMessageBox( "already open" );
return ;
}
if( !lrecTemp->Open() )
return;
if( !lrecTemp->CanUpdate( ) )
{
AfxMessageBox( "Unable to update the recordset." );
return;
}
if( !lrecTemp->CanAppend( ) )
{
AfxMessageBox( "Unable to add the recordset." + lrecTemp->GetTableName() );
return;
}
Cmessage *lrecTemp = theApp.GetSet();
if(lrecTemp->IsOpen())
{
AfxMessageBox( "already open" );
return ;
}
if( !lrecTemp->Open() )
return;
if( !lrecTemp->CanUpdate( ) )
{
AfxMessageBox( "Unable to update the recordset." );
return;
}
if( !lrecTemp->CanAppend( ) )
{
AfxMessageBox( "Unable to add the recordset." + lrecTemp->GetTableName() );
return;
}
Getset获得指向Cmessage的指针。
如:只读,只写,可读写,支持更新等等,具体可以查一下msdn
CRecordSet.Open()的相关用法!!!!