我在vb.net中导入ExcelSheet时如何获取正确的数据 [英] How to get the correct datas when i import the ExcelSheet in vb.net

查看:107
本文介绍了我在vb.net中导入ExcelSheet时如何获取正确的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的专家',



我正在做一个.Net winForms应用程序。现在我遇到了问题。当我导入Excel时,一切正常,期待一件事。



导入时我没有得到正确的数据(只有时间HDR = YES)



例如:Excel Datas =发票编号

导入后=发票编号



点(。)更改为哈希(#)。



我需要在连接字符串中使用HDR = yes的标题。



请在导入时帮我获取正确的数据。



我的连接字符串



 connectionString =   Provider = Microsoft.Jet.OLEDB.4.0;数据源=& fileName&  ;扩展属性=Excel 8.0; IMEX = 1; HDR = YES; 





.........



谢谢和问候



Dileep

解决方案

我认为你使用OLEDB ...如果是,那么连接字符串就可以了,但您需要更改查询。下面的查询应该是完美的:



  SELECT  [Invoice No#]  AS  [发票编号],[Field2],[Field3] 
FROM [Sheet1


Dear Expert''s,

I am Doing a .Net winForms Application. Now am stuck with a Problem. When i Import Excel, Everything is working fine expect one thing.

I didn''t get the correct datas when i import (Only the time HDR = YES)

Eg: Excel Datas = "Invoice No."
After Import = "Invoice No#"

Dot(.) is changed to Hash (#).

And i need header thats y am using HDR = yes in connection string.

Please help me to get the correct datas when i import.

My connection string

connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & fileName & ";Extended Properties=""Excel 8.0;IMEX=1;HDR=YES;"""



.........

Thanks and Regards

Dileep

解决方案

I think you use OLEDB... If yes, then connection string is OK, but you need to change a query. Below query should works perfect:

SELECT [Invoice No#] AS [Invoice No.], [Field2], [Field3]
FROM [Sheet1



这篇关于我在vb.net中导入ExcelSheet时如何获取正确的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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