2,507
社区成员
发帖
与我相关
我的任务
分享procedure TForm1.Button1Click(Sender: TObject);
var
sql:string ;
begin
try
ADOConnection1.Provider :='Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\Temp.xls;Extended ' +
'Properties="Excel 8.0;HDR=Yes;";Persist Security Info=False' ;
ADOConnection1.Connected := False ;
ADOConnection1.Connected := True ;
sqll := 'SELECT * into SQLEXCEL FROM ' +
'OpenDataSource(''Microsoft.Jet.OLEDB.4.0'',''Data Source="C:\temp\Temp.xls";Extended Properties="Excel 5.0;HDR=Yes;";Persist Security Info=False'')...sheet1$' ;
ADOConnection1.Execute(sql ) ;
Application.MessageBox('导出数据成功 !', PChar('数据导入导出提示'), MB_OK +
MB_ICONINFORMATION + MB_TOPMOST);
except
Application.MessageBox('导出数据失败 !', PChar('数据导入导出提示'), MB_OK +
MB_ICONINFORMATION + MB_TOPMOST);
end;
end;