Excelsheet到数据集如何忽略逗号(excel格式) [英] Excelsheet to dataset How to ignore comma (excel formatting)
本文介绍了Excelsheet到数据集如何忽略逗号(excel格式)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从excelsheet到C#数据集获取数据时:
我正在使用
When getting data from excelsheet to C# dataset :
I am using
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0;IMEX=1;HDR=NO;\"";
和
and
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0;IMEX=1;HDR=NO;\"";
我必须对列进行常规格式化,以便能够将数据库更新为整数列.
前
12,220-> 12220
15,445-> 15445
55,881-> 55881
Number(-1,234)->编号(普通)
我不希望按行进行修复
I have to make general formatting for column(s), so that able to update Database as integer column.
Ex
12,220 --> 12220
15,445 --> 15445
55,881 --> 55881
Number(-1,234) --> Number(General)
I don''t want fix(s) by row (by) row operation
it will degrade performance
推荐答案
格式化与从MS Excel工作表中导入数据无关.
阅读此内容:将Excel文件导入到DataSet [ http://www.connectionstrings.com/excel [ http://www.connectionstrings.com/excel-2007 [ ^ ]
请仔细阅读IMEX
选项;)
但是,如果您在使用千位和小数分隔符时遇到麻烦,请尝试手动 ^ ]或使用 ^ ]类,以编程方式更改它(以模仿其他设置).
Formatting has nothing to do with importing data from MS Excel sheet.
Read this: Import Excel File to DataSet[^]
If you use:Provider=Microsoft.ACE.OLEDB.12.0
driver, theExtended Properties
can NOT useExcel 8.0
value.
More about it, you''ll find at: http://www.connectionstrings.com/excel[^] and http://www.connectionstrings.com/excel-2007[^]
Read carefuly aboutIMEX
option ;)
But, if you got trouble with separator for thousends and decimals, try to manually change it[^] or use CultureInfo (System.Globalization)[^] class to change it programmatically (to imitate other settings).
这篇关于Excelsheet到数据集如何忽略逗号(excel格式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文