搜索
写经验 领红包

db怎么导出数据(dbeave数据导出)

dbgrideh导出数据

db怎么导出数据(dbeaver数据导出)+afei91688

Uses 里面加入 “,DBGridEhImpExp”

按钮里面加入如下代码:

var

ExpClass: TDBGridEhExportClass;

Ext: string;

SaveDlg: TSaveDialog;

begin

if DBGridEh1.DataSource.DataSet.IsEmpty then Exit;

SaveDlg := TSaveDialog.Create(nil);

SaveDlg.Filter := &39;;

SaveDlg.FileName := &39;;

SaveDlg.DefaultExt := &39;;

SaveDlg.Options := [ofOverwritePrompt, ofHideReadOnly, ofPathMustExist, ofEnableSizing];

if SaveDlg.Execute then

begin

case SaveDlg.FilterIndex of

1: begin ExpClass := TDBGridEhExportAsXLS;Ext := &39;;end;

2: begin ExpClass := TDBGridEhExportAsText;Ext := &39;;end;

3: begin ExpClass := TDBGridEhExportAsCSV;Ext := &39;;end;

4: begin ExpClass := TDBGridEhExportAsHTML;Ext := &39;;end;

5: begin ExpClass := TDBGridEhExportAsRTF;Ext := &39;;end;

else

ExpClass := nil;

end;

if ExpClass <> nil then

begin

if UpperCase(Copy(SaveDlg.FileName, Length(SaveDlg.FileName) - 2, 3)) <> UpperCase(Ext) then

SaveDlg.FileName := SaveDlg.FileName + &39; + Ext;

SaveDBGridEhToExportFile(ExpClass, DBGridEh1, SaveDlg.FileName, True);

end;

end;

SaveDlg.Destroy;

//dbgrideh1 代表是导出的表格

本文内容由快快网络小滢整理编辑!