发动机游车怎么解决:求救!将excel文件导入paradox中程序遇到的问题

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 18:07:06
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,0);//打开指定的EXCEL 文件
except
begin
ExcelApplication1.Disconnect;//出现异常情况时关闭
ExcelApplication1.Quit;showmessage('请选择EXCEL电子表格!');
exit;
end;
end;
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks[1]);//ExcelWorkbook1与Eexcelapplication1建立连接
ExcelWorksheet1.ConnectTo(ExcelWorkbook1.Worksheets[1] as _Worksheet);//Excelworksheet1与Excelworkbook1建立连接
for i:=2 to 100 do
begin
if trim(excelworksheet1.cells.item[i,1])<>'' then
begin
qr1.Close;
qr1.params.clear;
qr1.SQL.clear;
qr1.Params.CreateParam(ftstring,'xh',ptinput).asstring:=trim(excelworksheet1.cells.item[i,1]);
qr1.sql.text:='select * from students where xh=:xh';
qr1.execsql;
qr1.Open;
n:=qr1.recordcount;
if n=0 then
begin
Table1.Append;
for j := 1 to 11 do
begin
temp :=excelworksheet1.cells.item[i,j];
Table1.Fields[j - 1].AsString := temp;
end;
table1.post;//加上这句::::)))))
end;
end;
end;
ExcelApplication1.Disconnect;
ExcelApplication1.Quit;
end;
运行时总是提示下面这一行null,null,null,null,null,null,null,null,null,null,null,null,0);//打开指定的EXCEL 文件
有这样的错误
[Error] excel.pas(48): Not enough actual parameters
请问怎么解决啊???