。if (pRecordset->GetadoEOF ())
return false;
m_ctlDataGrid.SetRefDataSource (NULL);
//下面出错!提示:the rowset is not bookable.
m_ctlDataGrid.SetRefDataSource ((LPUNKNOWN)pRecordset); m_ctlDataGrid.Refresh ();
//add the recordset to the DataGrid Control and show them in the dialog
//
pRecordset->Close ();
pConn->Close();
请问如何处理??
return false;
m_ctlDataGrid.SetRefDataSource (NULL);
//下面出错!提示:the rowset is not bookable.
m_ctlDataGrid.SetRefDataSource ((LPUNKNOWN)pRecordset); m_ctlDataGrid.Refresh ();
//add the recordset to the DataGrid Control and show them in the dialog
//
pRecordset->Close ();
pConn->Close();
请问如何处理??
不过你用MS RemoteDataCtrl控件作为数据源,然后DataGrid Control 的DataSource用MS RemoteDataCtrl控件的ID号即可!!!!
m_pRecordset->CursorLocation=adUseClient;
m_pRecordset->Open((LPCSTR)TempSqlText,m_pConnection.GetInterfacePtr(), adOpenKeyset,adLockOptimistic,adCmdText);Recordset一定要写成以上形式..
但是,我问题的关键是DataGrid Control 的用法。
因为上面的记录集对象已经有记录,不是空的,关键是如何让此记录集作为DataGrid Control 的数据源???请大家帮忙!!
pRecordset->CursorLocation=adUseClient;
pRecordset->Open((LPCSTR)TempSqlText,m_pConnection.GetInterfacePtr(), adOpenKeyset,adLockOptimistic,adCmdText);
m_ctlDataGrid.SetRefDataSource (NULL);
m_ctlDataGrid.SetRefDataSource ((LPUNKNOWN)pRecordset);
m_ctlDataGrid.Refresh ();Recordset一定要写成以上形式..这样就行啦!你有没有试的??
这样就可以
pRecordset->CursorLocation=adUseClient;
pRecordset->Open((LPCSTR)TempSqlText,m_pConnection.GetInterfacePtr(), adOpenKeyset,adLockOptimistic,adCmdText);
m_ctlDataGrid.SetRefDataSource (NULL);
m_ctlDataGrid.SetRefDataSource ((LPUNKNOWN)pRecordset);
m_ctlDataGrid.Refresh ();