打开.dbf后,怎么实现表的spl查询,选择等
或者能不能打开整个数据库,用嵌入式的spl查询
或者能不能打开整个数据库,用嵌入式的spl查询
解决方案 »
- 怎么将字符串转换成16进制?
- 谁知道怎么关闭CDockablePane呢?
- windows下setsockopt设置接收超时问题
- 怎样对串口进行流量控制???
- 在INTERNET上TCP传输简单报文,如何防止出错?
- 怎么在我把代码转移文件夹以后会出现这种情况阿?!
- 散分,来着有分!询问面试要求的具体情况!共同建立公司软件开发Team,协力进行公司ERP, MIS, e化系统的开发工作!!
- Holly to oldworm!
- vc中如何让一个对话框象CScrollView类一样简易实现滚动?!
- 哪个大神帮我来看看~
- 怎样用Ado打开vfp的数据库?
- CRecordset::GetFieldValue(short,CString)出错
#include <windows.h>
#include <stdio.h>
#import "c:\Program Files\Common Files\System\ADO\msado20.tlb" \
no_namespace rename("EOF", "EndOfFile")
void PrintProviderError(_ConnectionPtr pConnection)
{
ErrorPtr pErr = NULL;
if( (pConnection->Errors->Count) > 0)
{
long nCount = pConnection->Errors->Count;
for(long i = 0;i < nCount;i++)
{
pErr = pConnection->Errors->GetItem(i);
printf("\t Error number: %x\t%s", pErr->Number,pErr->Description);
}
}
}
void main()
{
if(FAILED(::CoInitialize(NULL)))
return ;
_ConnectionPtr pConnection = NULL;
_bstr_t strConnection = TEXT("Driver={Microsoft dBASE Driver (*.dbf)};DBQ=C:\\; DriverID=533;");
try
{
_RecordsetPtr pRstSchema = NULL;
_CommandPtr pCommand=NULL;
pConnection.CreateInstance(__uuidof(Connection));
pConnection->Open (strConnection, "", "", -1);
pCommand.CreateInstance (__uuidof(Command));
pRstSchema.CreateInstance (__uuidof(Recordset));
_bstr_t sqltext="select * from jck98 ";
pCommand->ActiveConnection =pConnection;
pCommand->CommandText =sqltext;
pCommand->CommandType=adCmdText; pRstSchema = pCommand->Execute (NULL,NULL,adCmdText);
_variant_t filed[17];
_bstr_t filedname[17];
while (!pRstSchema->EndOfFile )
{
long kk=pRstSchema->GetFields ()->GetCount ();
for (long uu=0;uu<kk;uu++)
{
filedname[uu]=pRstSchema->GetFields ()->GetItem ((_variant_t)uu)->GetName ();
filed[uu]=pRstSchema->GetCollect (filedname[uu]);
}
pRstSchema->MoveNext ();
}
pRstSchema->Close();
pConnection->Close();
}
catch(...)
{
PrintProviderError(pConnection);
}
::CoUninitialize();
}