将Excel文件数据库导入SQL Server的三种方案
y.dbo.live41 out " + filePath + "-c -q -S" + "\"" + "\"" + " -U" + "\"" + "\"" + " -P" + "\"" + "\"" + "\''"; try { sqlConnection1.Open(); //SqlCommand sqlCommand1 = new SqlCommand(); //sqlCommand1.Connection = sqlConnection1; //sqlCommand1.CommandText = importSQL; //sqlCommand1.ExecuteNonQuery(); //MessageBox.Show("import finish!"); SqlCommand sqlCommand2 = new SqlCommand(); sqlCommand2.Connection = sqlConnection1; sqlCommand2.CommandText = exportSQL; sqlCommand2.ExecuteNonQuery(); MessageBox.Show("export finish!"); } catch(Exception ex) { MessageBox.Show(ex.ToString()); } } if(sqlConnection1!=null)
OpenFileDialog openFile = new OpenFileDialog(); ExcelIO excelio = new ExcelIO(); if(openFile.ShowDialog()==DialogResult.OK) excelio = new ExcelIO(openFile.FileName); int x = range.GetLength(0); DataTable dt = new DataTable("xlsTable"); for(int c=1; c<=y; c++) for(int j=1 |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |