用RecordSet读到数据后,如何通过Filed的Index来访问数据? 用RecordSet读到数据后,如何通过Filed的Index来访问数据? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 怎么没有找到?我用的是_RecordsetPtr _variant_t vCount = _pRecordset->GetCollect(vIndex);///取得第一个字段的值放入vCount变量 tye like this: CoInitialize(NULL); try { _ConnectionPtr pConn("ADODB.Connection"); _RecordsetPtr pRst("ADODB.Recordset"); pConn->Open("Driver={Microsoft dBASE Driver (*.dbf)};DBQ=C:\\tmp\\; DriverID=533;" ,"","",adConnectUnspecified); pRst->Open("images", _variant_t((IDispatch *) pConn, true), adOpenStatic, adLockReadOnly, adCmdTable); FieldsPtr fds=pRst->GetFields(); printf("printf field name of all the table\n"); for(int i=0;i<fds->GetCount();i++) { FieldPtr fd=fds->GetItem(_variant_t(short(i))); printf("%s ",(LPCTSTR)fd->GetName()); } printf("\n"); pRst->Close(); pConn->Close(); } catch (_com_error &e) { printf("Description = '%s'\n", (char*) e.Description()); }::CoUninitialize(); to kingzai() 呵呵,贴了两遍 VC透明按钮问题 (散分)工资加倍,仍走人,长沙不是混IT的地方 怎么操作EDIT的滚动条 请教:Visual C++7.0 检测内存泄露的工具 求助:将内存中的位图数据显示出来 请教已经编译好的dll怎样打开知道里面的原函数,分不够再加 __try __exception __finally 可不可以连着用呀? 打印时,如何编程指定打印纸张大小? 停靠窗口的焦点问题 我想从WINME中自带的一个驱动程序提取出来在WIN97中安装,请问应如何做? 问题十分简单,看你愿不愿意拿分! 一个在VC中嵌入汇编代码的问题
CoInitialize(NULL);
try
{
_ConnectionPtr pConn("ADODB.Connection");
_RecordsetPtr pRst("ADODB.Recordset");
pConn->Open("Driver={Microsoft dBASE Driver (*.dbf)};DBQ=C:\\tmp\\; DriverID=533;"
,"","",adConnectUnspecified);
pRst->Open("images", _variant_t((IDispatch *) pConn, true),
adOpenStatic, adLockReadOnly, adCmdTable);
FieldsPtr fds=pRst->GetFields();
printf("printf field name of all the table\n");
for(int i=0;i<fds->GetCount();i++)
{
FieldPtr fd=fds->GetItem(_variant_t(short(i)));
printf("%s ",(LPCTSTR)fd->GetName());
}
printf("\n");
pRst->Close();
pConn->Close();
}
catch (_com_error &e)
{
printf("Description = '%s'\n", (char*) e.Description());
}
::CoUninitialize();