怎么把dbgrid和自己建的记录集联系起来 用micorsoft route dbgrid 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你是说用micorsoft remotedata control吗?我用了,我可以显示数据表,但是我的目的是显示我的结果记录集 void CDgDlg::OnOK() { // set datasource of DBGrid dynamically //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); }} 动态创建Groupbox,显示异常问题 请教CTabCtrl添加两个Dialog,如何从dialog1获取dialog2的地址? 如何使用ListCtrl显示图片? 这个版新帖子太少,难道没多少人学VC了吗 我的AfxBeginThread(func,(LPVOID)pt) 为什么无法传递参数?!!请看。。。。 picture control显示png问题 请教两个概念性问题,请进!谢谢! 请问大侠:CButtonST类如何应用在视图中? strip 到这里来拿分 ATL中添加一个string属性 SOS!请大家帮帮我,急用 感兴趣的进来:OICQ中那个会闪烁的"消息"菜单是如何做出来的?
{
// set datasource of DBGrid dynamically
//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);
}
}