将数据先导成文本文件,然后用EXCEL的宏语言进行读入,速度绝对惊人,
可以是你以前的数百倍
可以是你以前的数百倍
解决方案 »
- 请问PACKAGES 到底和DLL有什么联系
- 我想知道上海哪里有打印机、复印机、扫描仪维修培训?
- 如何从3个相关表格中分别查询数据并放入到一个DBGrid中显示?
- 各位大哥帮忙!!!!!!!!!!!!UP有分,大家出力
- 我想写一个COM对象来实现IOBJECTWITHSIT,但我的系统没有这个接口?
- 很难解决的问题!!!!!(很急哦请帮帮我)
- fastreport控件的帮助
- 谁有bitbtn里面的好看一点的bmp,发到我邮箱里,一定加分?先发先加
- 有没有人遇到过这种情况?
- 各位大哥怎样培养编程的兴趣呢?——白小姐
- dbgrid的dgmultiselect设为ture就可以在表格选择多条记录,我现在要删除在表格中的选择记录,就是返回选择中的记录。
- Delphi中怎样才能使用VC中的对象---- 在线给分
procedure adoquerytoexcel(Aadoquery:TCustomADODataSet) ;
var
XLApp: Variant;
i:integer;
Sheet: Variant;
begin
if Aadoquery.IsEmpty then exit;
// if Aadoquery.RecordCount=0 then exit;
XLApp:= CreateOleObject('Excel.Application');
XLApp.Visible := True;
XLApp.Workbooks.Add(-4167);
XLApp.Workbooks[1].WorkSheets[1].Name :='ϵͳÊý¾Ý';
Sheet := XLApp.Workbooks[1].WorkSheets['ϵͳÊý¾Ý']; for i := 1 to Aadoquery.fieldcount do
begin
Sheet.Cells[1, i] :=Aadoquery.fields[i-1].FieldName;
end;
sheet.cells[2,1].copyfromrecordset(AAdoQuery.recordset);
end;
很快的,
BDE倒的方法也有很多,讨论的贴子也不少,你找一下就可以看到了。
procedure TForm14.DataSetToASCII(const ADataSet: TDataSet; const ASCIIFile: TFileName; const Delimiter: Char; const QuoteStrings: Boolean);var tmpList: TStringList;
i,LastIndex: LongInt;
AsciiRecord: String;
begin
tmpList:= TStringList.Create;
try
with ADataSet do begin
LastIndex:= Fields.Count - 1;
First;
while not EOF do begin
AsciiRecord:= '';
for i := 0 to LastIndex do
if Fields.Fields[i].Tag = 0 then begin
if QuoteStrings and
(Fields.Fields[i].DataType in [ftString,ftMemo,ftFmtMemo,ftFixedChar,ftWideString]) then
AsciiRecord:= AsciiRecord + QuotedStr(Fields.Fields[i].AsString)
else
AsciiRecord:= AsciiRecord + Fields.Fields[i].AsString;
if i < LastIndex then
AsciiRecord:= AsciiRecord + Delimiter;
end;
tmpList.Append(AsciiRecord);
Next
end
end;
try
tmpList.SaveToFile(ASCIIFile+'.txt') ;
except
ShowMessage('Could not save table to specified file: ' + ASCIIFile)
end;
finally
tmpList.Free;
end;
end;
有几个地方不明白:
XLApp.Workbooks.Add(-4167); -4167是何含义?
'ϵͳÊý¾Ý'有特殊意义吗?
quick report的专业版有个excel filter,能做到你想要的,不过
但是在用Excel打开所存的文件时,总是提示格式不对,
不知为什么?(用ADOQuery.SaveToFiles('abc.xls'))
但是用F1book直接存成Excel就可以。