急!!excel导入paradox程序调试错误!

来源:百度知道 编辑:UC知道 时间:2024/06/05 18:23:36
project project1.exe raised exception class EDBEngineError with message 'Table doees not exist.
file or directory dose not exist.
file:E:\delphi\excel\试验.DB
file:E:\delphi\excel\试验.dbf
file:E:\delphi\excel\试验.txt
file:cE:\\delphi\excel\试验'.Process stopped.Use Step or run to continue.
代码如下:
procedure TForm1.Button1Click(Sender: TObject);
var i,j,n:integer;
temp:string;
begin
opendialog1.InitialDir:=ExtractFileDir(paramstr(0));//文件的打存放初始路径
opendialog1.Execute;
Try
ExcelApplication1.Connect;//EXCEL应用程序
Except
MessageDlg('Excel may not be installed',mtError, [mbOk], 0);
Abort;
End;
ExcelApplication1.Visible[0]:=true;
ExcelApplication1.Caption:='Excel Application';
try
excelapplication1.Workbooks.Open(opendialog1.FileName,
null,null,null,null,null,null,null,null,null,null,null,null

在ACCESS中打开某个数据库
单击菜单 文件-获取外部数据-导入,在对话框中选择要用的EXCEL文件
按照向导提示执行就行了,可以放在新表中,也可以放在已有的表中。

但是要注意,最好是在EXCEL中为使用的数据作个命名区域,还有EXCEL中的数据一定要规规矩矩,第一行是列标题,下面各行是数据,标题和数据不要跨列,不要有合并的单元格,否则可能不行。