我在VC中用ADO已获得了记录集m_recordset_lms,然后用下面的语句来与CDataGrid控件m_datagrid_lms绑定,出现了致命的错误?请教该如何去做??绑定语句如下:
m_datagrid_lms.SetRefDataSource(m_recordset_lms);
m_datagrid_lms.Refresh();
m_datagrid_lms.SetRefDataSource(m_recordset_lms);
m_datagrid_lms.Refresh();
解决方案 »
- 怎么识别richedit中的email地址
- 用com实现浏览器功能
- 求助vc++ excluded text 问题
- CList::InsertItem调用的哪个dll哦,我想下钩子
- 我该怎么走下去?
- 在winsock api 编程中如何引入WINSOCK 库(ws_32.lib或ws2_32.lib)!
- 简单问题,回复有分!
- 高分在线求解!
- 在ondraw中用moveto,lineto绘制了一条曲线,请问如何获得在鼠标移动到曲线上时在鼠标的右上角显示一个tip,来显示出现在位置曲线的x,y坐
- CDC类的使用,困惑
- 用SDK寫的DLL,在VB中調用時出現"Can not find Entry point" 的問題.
- 大家进来看看,对编程最有用的两样东西:!!!!
{ //notes : call AfxOleInit in CXXApp::InitInstance()
// I also add a line in stdafx.h
//#import "c:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF", "EndOfFile")
try
{
_ConnectionPtr pConn("ADODB.Connection");
_RecordsetPtr pRst("ADODB.Recordset");
pConn->Open("Provider=sqloledb;Data Source=Dell1;"
"Initial Catalog=testdb;User Id=sa;Password=;",
"", "", adConnectUnspecified);
pRst->Open(
"table1",
_variant_t((IDispatch *) pConn, true),
adOpenStatic,
adLockReadOnly,
adCmdTable);
//CDataGrid m_grid; is a member of CDgDlg.
m_grid.SetRefDataSource(pRst.Detach());
}
catch (_com_error &e)
{
char mybuf[10240];
wsprintf(mybuf,"Description = '%s'\n", (char*) e.Description());
AfxMessageBox(mybuf);
}
}
我想变成三颗星还要等多久啊?
m_datagrid_lms->CursorLocation = adUseClient;