Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
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
Posted 27-Jan-13 19:52pm
Edited 27-Jan-13 20:12pm
Richard MacCutchan at 28-Jan-13 6:13am
I have just tried this and get exactly the same result, but I don't know why it happens.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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$]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 mhegazy94 460
1 Sergey Alexandrovich Kryukov 405
2 Kornfeld Eliyahu Peter 275
3 Gihan Liyanage 163
4 Sibeesh KV 156
0 Sergey Alexandrovich Kryukov 6,775
1 OriginalGriff 6,696
2 CPallini 5,345
3 George Jonsson 3,599
4 Gihan Liyanage 2,751

Advertise | Privacy | Mobile
Web04 | 2.8.140922.1 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100