这是把数据库导出为EXCEL的语句,帮我看一下最后的那句是什么意思?过不了,还请帮我看看这段语句能不能成功的把PARADOX表导出为EXCEL2000(50分)

  • 主题发起人 主题发起人 redwood
  • 开始时间 开始时间
R

redwood

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.N3Click(Sender: TObject);
var f:textfile;
fs,str:string;
i,j,k:integer;
begin
if not Query_out.IsEmpty then
begin
if savedialog1.execute then
begin
fs:=savedialog1.filename;
assignfile(f,fs);
rewrite(f);
for i:=0 to Query_out.FieldCount-1 do
begin
begin
str:=Query_out.Fields.Displaylabel;
for j:=Query_out.Fields.datasize to 35 do
begin
str:=str+' ';
end;
write(f,str);
end;
end;
writeln(f,'');
Query_out.first;
for i:=0 to Query_out.RecordCount-1 do
begin
for j:=0 to Query_out.FieldCount-1 do
begin
str:=Query_out.Fields[j].Displaytext;
for k:=Query_out.Fields[j].datasize to 35 do
begin
str:=str+' ';
end;
write(f,str);
end;
writeln(f,'');
Query_out.next;
end;
filestr1:=fs;//就是这一句,什么意思?
closefile(f);
end;
end
else
begin
showmessage('empty table');
end;
Query_out.first;
end;
 
明明是导入到文本嘛,俺眼花了??
 
老完!帮帮忙,解决一下!
我也发现这是个很大的错误!!!这段程序是重这里的全文里搜出来的……
 
var
i,row,column:integer;
begin
Try
ExcelApplication1.Connect;
Except
MessageDlg('Excel may not be installed',
mtError, [mbOk], 0);
Abort;
End;
ExcelApplication1.Visible[0]:=True;
ExcelApplication1.Caption:='Excel Application';
ExcelApplication1.Workbooks.Add(Null,0);
ExcelWorkbook1.ConnectTo
(ExcelApplication1.Workbooks[1]);
ExcelWorksheet1.ConnectTo
(ExcelWorkbook1.Worksheets[1] as _Worksheet);
query1.Open;
row:=1;
While Not(query1.Eof) do
begin
column:=1;
for i:=1 to query1.FieldCount do
begin
ExcelWorksheet1.Cells.Item[row,column]:
=query1.fields[i-1].AsString;
column:=column+1;
end;
query1.Next;
row:=row+1;
end;
end;

 
编译通过,可是运行时显示没有注册类别
然后指到这一行
ExcelApplication1.Connect;

怎么回事呀?
 
原来没有装EXCEL,这段语句 2000 XP 都可以用吗?
我把QUERY练到了要输出的TABLE上
晕呼!!!!!QUERY!为空怎么用啊?系统显示 No SQl statement available...

 
晕呼!!把QUERY改成TABLE就好了……
 
后退
顶部