在确定下的代码:
var
str:string;
begin
DataSource.DataSet.Open;
Business.Forms.ExcelFieldMapFunc.ShowFieldMapEditor(ExcelToTable1);
ExcelToTable1.Execute(str);
dialogs.ShowMessage(str);
end;
6楼的代码看了。。换成为
procedure TMAINFORM.Button1Click(Sender: TObject);
var
lExcelToTable:TExcelToTable;
lmsg:string;
begin
if OpenDialog1.Execute then
begin
lExcelToTable:=TExcelToTable.Create(self);
try
lExcelToTable.FileName := OpenDialog1.FileName;
lExcelToTable.DataSource:=DataSetBroker1;
if ExcelFieldMapFunc.ShowFieldMapEditor(lExcelToTable) then
begin
if not lExcelToTable.Execute(lmsg) then
begin
jsDialogs.ShowError(lmsg, '导入excel失败!');
end ;
end;
finally
lExcelToTable.free;
end;
end;
end;