Tag: 散装

Sqlbulkcopy浮动转换错误(asp.net c#)

Iam试图插入大量的Excel到SQL sqlBulk.WriteToServer(dReader); 给出错误 来自数据源的Stringtypes的给定值不能转换为指定目标列的floattypes。 Iam使用下面的代码 System.Data.SqlClient.SqlConnection strConnection; strConnection = new System.Data.SqlClient.SqlConnection("Data Source=L06DPSGCD0001;Initial Catalog=ProductionEfficiency;User ID=sample;Password=sample"); string path = ("C:\\Users\\s3802616\\Desktop\\" + (FileUpload1.FileName)); System.Diagnostics.Debug.WriteLine("C:\\Users\\s3802616\\Desktop\\" + (FileUpload1.FileName)); string excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=" + "\"" + "Excel 12.0;HDR=YES;" + "\""; //Create Connection to Excel work book OleDbConnection excelConnection = new OleDbConnection(excelConnectionString); //Create OleDbCommand to fetch […]