[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

cell in Excel with Date format is read by ADO.NET as NULL

Posted on 2004-11-28
5
Medium Priority
?
440 Views
Last Modified: 2008-01-09
My problem is the title itself.

I have tried to read an excel file using ADO.NET (as opposed to automation, which forces me to create an instance of an excel process).

Using a data adapter, I call the Fill() method and pass a datatable (most examples on the internet feature passing a dataset).

In the datatable, I am able to read the cells whose values has a string format.
But somehow, the cells with date format are null when I try to read it.

Did I miss some setting?
Should I set something in the datatable variable before using it?
Or do I really have to use a dataset instead? This should not matter, right?
0
Comment
Question by:DrkLight
  • 2
  • 2
5 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 12695598
Hi DrkLight,

Strange, I don't seem to have this problem. Could you show your code (including your connection string).

are you sure the date in your excel in in the format of your regional settings
0
 

Author Comment

by:DrkLight
ID: 12702040
Thanks for the reply.

I've also thought of this.

I checked the style of the date cell formatting and nothing seems to be strange.
In fact, I even downloaded from the internet a different program that does almost the same thing (reads excel files).  That program is able to read the date cell on another file that it creates.
But when I use it to read my excel file, it also fails.
I have tried changing the date cell to various formats availabale for a date, but it still returns null.

I have tried printing out the contents of the read excel file (whether by datatable or by datareader).
Either way, the date cells are returned as null. =(

There was one cell though where the date was shown.
This cell shows the date in the style with the asterisk (I am using WinXP J-OS so its kind of hard to explain)
0
 

Author Comment

by:DrkLight
ID: 12702460
Thanks RonaldBiemans, but I found the solution to my problem.

As advised by this link,
http://support.microsoft.com/?id=194124
I added the "IMEX=1" extended property and was able to retrieve my data already...

My excel data is kind of awry (not the standard table fromat) so this works fine for me.
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 12703509
Great, then get a refund for your points at comminity support
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12704030
Closed, 125 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question