我正在使用 SqlBulkCopy 將數(shù)據(jù)從 excel 和另一個(gè)數(shù)據(jù)庫導(dǎo)入到 2 個(gè)不同的 SQL 表中。一切都很順利,直到我每次在目標(biāo)表中丟失一行時(shí),無論是來自 excel 還是來自其他數(shù)據(jù)庫的源。連接字符串如下:private string GetExcelConnectionString(string excelfile) { Dictionary<string, string> props = new Dictionary<string, string> { ["Provider"] = "Microsoft.ACE.OLEDB.12.0", ["Extended Properties"] = "'Excel 12.0 XML;HDR=YES'", ["Data Source"] = excelfile }; StringBuilder sb = new StringBuilder(); foreach (KeyValuePair<string, string> prop in props) { sb.Append(prop.Key); sb.Append('='); sb.Append(prop.Value); sb.Append(';'); } return sb.ToString(); }
- 1 回答
- 0 關(guān)注
- 213 瀏覽
添加回答
舉報(bào)
0/150
提交
取消