如何将dbf文件导入到access
有一个dbf格式的文件,我想先上传到服务器,然后再实现导入到access数据库,怎么用程序来实现呢,asp的...
有一个dbf格式的文件,我想先上传到服务器,然后再实现导入到access数据库,怎么用程序来实现呢,asp的
展开
1个回答
展开全部
如下代码来自我自编的测试程序
procedure TForm1.Button1Click(Sender: TObject);
begin
try
ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+ExtractFilePath(Application.EXEName)+
'empty.mdb;Jet OLEDB:Database Password=';
ADOConnection1.Connected:=true;
except
showmessage('无法打开数据库,请:1.确认文件''zzglxt.mdb''在'+'下;2.运行该目录下的mdac_typ25.exe安装MDAC数据库驱动!!');
exit;
end;
// ADOConnection1.Execute('insert into szbmk select * from 6001szbmk in ''D:\dbf和acess相互转换'' ''dbase 5.0;'' order by bmh')
ADOConnection1.Execute('select * into szbmk from 6001szbmk in ''D:\dbf和acess相互转换'' ''dbase 5.0;'' order by bmh')
end;
procedure TForm1.Button2Click(Sender: TObject);
var
sql:string;
begin
try
ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+ExtractFilePath(Application.EXEName)+
'empty.mdb;Jet OLEDB:Database Password=';
ADOConnection1.Connected:=true;
except
showmessage('无法打开数据库,请运行该目录下的mdac_typ25.exe安装MDAC数据库驱动!!');
exit;
end;
sql := 'SELECT * INTO szbmk in ''D:\dbf和acess相互转换'' ''dbase 5.0;'' FROM szbmk';
ADOConnection1.Execute(sql);
end;
或是试试这个:
直接用BATCHMOVE控件,在BDE控件里的.
procedure TForm1.Button1Click(Sender: TObject);
begin
try
ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+ExtractFilePath(Application.EXEName)+
'empty.mdb;Jet OLEDB:Database Password=';
ADOConnection1.Connected:=true;
except
showmessage('无法打开数据库,请:1.确认文件''zzglxt.mdb''在'+'下;2.运行该目录下的mdac_typ25.exe安装MDAC数据库驱动!!');
exit;
end;
// ADOConnection1.Execute('insert into szbmk select * from 6001szbmk in ''D:\dbf和acess相互转换'' ''dbase 5.0;'' order by bmh')
ADOConnection1.Execute('select * into szbmk from 6001szbmk in ''D:\dbf和acess相互转换'' ''dbase 5.0;'' order by bmh')
end;
procedure TForm1.Button2Click(Sender: TObject);
var
sql:string;
begin
try
ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+ExtractFilePath(Application.EXEName)+
'empty.mdb;Jet OLEDB:Database Password=';
ADOConnection1.Connected:=true;
except
showmessage('无法打开数据库,请运行该目录下的mdac_typ25.exe安装MDAC数据库驱动!!');
exit;
end;
sql := 'SELECT * INTO szbmk in ''D:\dbf和acess相互转换'' ''dbase 5.0;'' FROM szbmk';
ADOConnection1.Execute(sql);
end;
或是试试这个:
直接用BATCHMOVE控件,在BDE控件里的.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询