ASP.Net SqlBulkCopy一些文本数据类型值转换为指数值
ASP.Net SqlBulkCopy 将一些文本数据类型值转换为指数值,
bulkCopy.DestinationTableName = "TABLE NAME";
bulkCopy.ColumnMappings.Add("Mobilenumber", "Mobilenumber");
bulkCopy.WriteToServer(dr);
上面的代码将文本数据类型的 Excel 列 mobilenumbers 插入数据库列 mobilenumber varchar(100)
有些数字插入时没有任何更改,但有些数字作为指数值插入。
如果 Excel 列的数据类型更改为 Number,前导零为 0,则无需转换为指数,值将插入到数据库表中。
我的要求是无需手动转换任何工作表数据类型(仅限工作表),我必须上传,因为我必须上传许多文件。 请问有人可以帮忙解决这个问题吗?
ASP.Net SqlBulkCopy some text data type values converting to exponential values
bulkCopy.DestinationTableName = "TABLE NAME";
bulkCopy.ColumnMappings.Add("Mobilenumber", "Mobilenumber");
bulkCopy.WriteToServer(dr);
above code inserting excel column mobilenumbers of text data type to database column mobilenumber varchar(100)
Some numbers are inserting without any change but some numbers inserting as exponential values.
If datatype of excel column changed to Number with leading zeroes is 0 then without converting into exponential , values are inserting into database table.
My requirement is without converting any sheet datatype (To the sheet only) manually, i have to upload because i have to upload many files.
Please, can any one help on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过使用以下连接字符串并更改 Jet 和 ACE 注册表中 TypeGuessRows=0 的设置。
By using the below connection strings and changing the setting for TypeGuessRows=0 in the registry of Jet and ACE.