有哪位大神還記得C++builder這個軟體么,我最近用這個軟體的ADO模塊里的控制元件打開DBF資料庫遇到了一些問題,一共用了ADO里的Connection,Table,datasource還有DBgrid,用同樣的方法BDE可以打開資料庫,ADO.就不行,想請教一下各位大神,幫幫妹妹吧



代碼如下#include <vcl.h>
#pragma hdrstop
#include "stdio.h"
#include "string.h"
#include "iostream.h"
#include "stdlib.h"
#include "ctype.h"
#include "conio.h"
#include "math.h"
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
float xh[300], pi[300],s;
int i=0,j,i1,i2=0,i3,flag=0,n;AnsiString cc;
FILE *fp,*fp1,*fp2;
OpenDialog1->Filter="分層資料庫檔案(*.DBF)|*.DBF|所有檔案(*.*)|*.*";
if(OpenDialog1->Execute())
{
for(int I=0;I<OpenDialog1->Files->Count;I++)
{
fp=fopen(OpenDialog1->Files->Strings[I].c_str(),"r");
cc=OpenDialog1->Files->Strings[I].c_str();
if(fp)
{
ADOTable1->TableName=cc;
ADOTable1->Open();
DBGrid1->DataSource=DataSource1;
ADOTable1->Active=true;
ADOTable1->First();
while(!ADOTable1->Eof)
{
xh[i]=ADOTable1->FieldByName("小層界限外")->Value; //讀取“小層界限外”分層資料資訊
Image1->Canvas->TextOutA(10,10+i*25,xh[i]);
i++;
ADOTable1->Next();
}
ADOTable1->First();
}
}
}
}

uj5u.com熱心網友回復:
哪位大哥幫幫忙
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/281897.html
標籤:新技術前沿
上一篇:幻燈片設計的參考說明
下一篇:access資料庫線表長度計算
