Excel数据导入SQL SERVER的技巧
进销存管理软件版1楼: 如何把Excel数据导入SQL SERVER中.大家帮帮忙?
begin
//EXCEL2MSSQL
ADOConnection1.ConnectionString:=''Provider=SQLOLEDB.1;Password=KCSOFT58;Persist Security Info=True;User ID=SA;Initial Catalog=KCSOFT_HIS;Data Source=CHEN'';
ADOConnection1.Execute(''SELECT * into [abc] FROM OpenDataSource( ''
+QuotedStr(''Microsoft.Jet.OLEDB.4.0'')+'',''
+QuotedStr(''Data Source="G:\mysmallexe\excel2sql\yp.xls";Extended Properties=excel 8.0'')+'')...[Abc]'');
end;
+QuotedStr(''Data Source="G:\mysmallexe\excel2sql\yp.xls";Extended Properties=excel 8.0'')+'')...[Abc]'');
[abc] 是否相當與 xls中的[sheet1], [sheet2]
2楼: 你是在程序中导入? 如p3工程管理软件
3楼: 你能不能说清楚点啊
是直接导入还是用D导入
4楼: 在D程序中完成!
还需要提供让用户修改EXCEL内容的界面.
5楼: 还需要提供让用户修改EXCEL内容的界面
实现这点比完成题目那个要求复杂多了。
6楼: procedure TForm1.btn_EXCEL2MSSQLClick(Sender: TObject);
begin
//EXCEL2MSSQL
ADOConnection1.ConnectionString:=''Provider=SQLOLEDB.1;Password=KCSOFT58;Persist Security Info=True;User ID=SA;Initial Catalog=KCSOFT_HIS;Data Source=CHEN'';
ADOConnection1.Execute(''SELECT * into [abc] FROM OpenDataSource( ''
+QuotedStr(''Microsoft.Jet.OLEDB.4.0'')+'',''
+QuotedStr(''Data Source="G:\mysmallexe\excel2sql\yp.xls";Extended Properties=excel 8.0'')+'')...[Abc]'');
end;
进销存管理软件版7楼: to :shine007
procedure TForm1.btn_EXCEL2MSSQLClick(Sender: TObject);
begin
//EXCEL2MSSQL
ADOConnection1.ConnectionString:=''Provider=SQLOLEDB.1;Password=KCSOFT58;Persist Security Info=True;User ID=SA;Initial Catalog=KCSOFT_HIS;Data Source=CHEN'';
ADOConnection1.Execute(''SELECT * into [abc] FROM OpenDataSource( ''
+QuotedStr(''Microsoft.Jet.OLEDB.4.0'')+'',''
+QuotedStr(''Data Source="G:\mysmallexe\excel2sql\yp.xls";Extended Properties=excel 8.0'')+'')...[Abc]'');
end;
+QuotedStr(''Data Source="G:\mysmallexe\excel2sql\yp.xls";Extended Properties=excel 8.0'')+'')...[Abc]'');
[abc] 是否相當與 xls中的[sheet1], [sheet2]
8楼: 導入很簡單﹐修改就很麻煩(也可看delphi6徹底研究)﹐自己查一下﹐論壇上有的。
9楼: 接受答案了.
上一篇:关于断点问题!怎么断点可以设在注译中啊???是不是断点"移 下一篇:数据更新