ADO类打开dbf文件问题!
std::string strConnectString = "Provider=MSDASQL.1;Driver=Microsoft Visual Foxpro Driver;SourceDB=";
strConnectString += "f:\\333.dbf";//dbf文件夹所在路径
strConnectString += ";SourceType=DBF;Deleted=Yes;Exclusive=No;Null=No;";
if (!AdoDB.Open(strConnectString.c_str()))
{
MessageBox("打开DBF表失败!");
return FALSE;
}
char sql[1024] = {0};
strcpy(sql, "select Msg1 from A");
if (!AdoRset.Open(sql, AdoRset.openQuery))
//执行后出现错误!
CADORecordset Error Code = 80040e37 Code = IDispath error 3127 ......
why??"f:\\333.dbf";路径333改hhh一个不存在的文件也会出现相同的错误!why?、
那位大侠教教我啊!!
[解决办法]
'ADO连接DBF数据库
Dim conn As New ADODB.Connection
conn.ConnectionString = "provider=msdasql;DRIVER=Microsoft Visual FoxPro Driver;UID=;Deleted=yes;Null=no;Collate=Machine;BackgroundFetch=no;Exclusive=No;SourceType=DBF;SourceDB=C:\fox\data;"
conn.Open
[解决办法]
这个是dbf所在的文件目录
[解决办法]
conn.Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" & dbfPath & ";Exclusive=No;"