Excelsheet到数据集如何忽略逗号(excel格式) [英] Excelsheet to dataset How to ignore comma (excel formatting)

查看:97
本文介绍了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, the Extended Properties can NOT use Excel 8.0 value.

More about it, you''ll find at: http://www.connectionstrings.com/excel[^] and http://www.connectionstrings.com/excel-2007[^]
Read carefuly about IMEX 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆