dbf文件可以用access打开,如果打不开,恐怕不是标准的dbf文件
解决方案 »
- VC连接SQL Server数据库
- 怎样使SDI界面的工具栏能和菜单栏拖在同一行?
- 如何使“只读数据”不常驻内存?——关于程序执行效率的优化问题
- DialogBoxParam如何创建一个有回调函数的对话框?主要第3个参数 一直没搞懂
- WSAAsyncSelect怎样绑定在dll中对话框?
- 如何把用户名密码信息在点击提交的时候同时保存到本地硬盘的某个文件里,在下次加载此页面的时候自动填充用户名密码
- 开始学习VC,求鼓励。
- 如何设置LISTVIEW中每个"单元格"的颜色
- 有人对dllhost.exe 这个命令了解吗?
- 毕业了,找工。。
- Enter键的ASCII码是多少?
- Enter键的ASCII码是什么?
#include "stdafx.h"
#import "c:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename("EOF", "EndOfFile")
int main(int argc, char* argv[])
{
printf("Use ADO to open c:\\tmp\\images.dbf database file!\n");
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();
return 0;
}
我试过了
在 "stdafx.h"中
#import "c:\Program Files\Common Files\System\ado\\msado15.dll" no_namespace rename("EOF", "EndOfFile")
才行,