我有一个问题,我想将多行Excel文件传递给SQL Server notificationItem(
text = tags$div(textOutput("regis"),style = "display: inline-block; vertical-align: middle;"), icon("users")
)
,我对此一无所知。
我有一个要导入的Excel文件,需要将数据插入三个不同的表中。我已成功将数据导入到一个表中,如下所示
stored procedure
如何将行发送到存储过程而不是任何string path = string.Concat((Server.MapPath("~/temp/"+FileUpload1.FileName)));
FileUpload1.PostedFile.SaveAs(path);
OleDbConnection oleCon = new OleDbConnection("Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" + path + ";Extended Properties = Excel 12.0;");
OleDbCommand cmd = new OleDbCommand("select * from [Sheet1$]",oleCon);
OleDbDataAdapter dtap = new OleDbDataAdapter(cmd);
oleCon.Open();
DbDataReader rdr = cmd.ExecuteReader();
string con_str = @"Data source = .;Initial Catalog=practiceDB;Integrated security=True";
SqlBulkCopy bulkInsert = new SqlBulkCopy(con_str);
bulkInsert.DestinationTableName = "Excel_New";
bulkInsert.WriteToServer(rdr);
oleCon.Close();
Array.ForEach(Directory.GetFiles((Server.MapPath("~/temp/"))),File.Delete);
?
答案 0 :(得分:0)
不是将行作为参数传递,而是只从存储过程中的表Excel_New
中读取它?