vc++ datagrid need help

HI
i put a datagrid1 in dialog,then use class wizard define a member vairable m_dbgrid1,i want to use recordset to show the data
my code is:
CString sql1,temp;
sql1.Format("select * from tbuser");
m_pConnection1.CreateInstance(__uuidof(Connection));
m_pConnection1->Open("Provider=MSDAORA.1;Data Source=yu;","test","test123",adModeUnknown);
m_pRecordset1.CreateInstance(__uuidof(Recordset));
m_pRecordset1->CursorLocation=adUseClient;
m_pRecordset1->CacheSize=1000;
m_pRecordset1->Open((_bstr_t)sql1,m_pConnection1.GetInterfacePtr(),adOpenStatic,adLockOptimistic,adCmdText);
m_dbgrid1.SetCaption(_T("aaaaaaaa"));
m_dbgrid1.SetRefDataSource((LPUNKNOWN)(m_pRecordset1));
m_dbgrid1.Refresh();
temp.Format("%d",m_pRecordset1->RecordCount);
MessageBox(temp);
but now no datagrid display,the datagrid's caption didn't display
other peoples said recordset has GetRecordset method,but i can not find
how can i show the data in a datagrid using VC++
i need help,thanks a lot
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories