Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dates Not Showing In DataSet
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01451290
Message ID:
01451302
Views:
47
>>>>I posted on this yesterday, and only Michel responded. However I am behind schedule on this and I just don't have the time to convert his VB classs to C#, then debug//test, all in the hopes it might solve this.
>>>>
>>>>I'm reading an Excel file into a dataset. The entire file comes into the DS with one exception. There are multiple date columns. The first
>>>>date column comes in as DateTime. No problem there. All remaining date columns are empty. When I open the file as a CSV, the
>>>>other date columns look like dates. I thought I would import the CSV in, but there are commas in the data.
>>>>
>>>>I have no idea why this is happening. Anyone seen this before?
>>>
>>>Does your excel file have a bunch of blank dates in the first rows in the columns that are not importing?
>>
>>yes
>
>I'm not sure if this helps or not, but SQL Server has had an issue when importing from Excel where columns that should be Dates would come out as varchar because SQL samples data in the first (some number as default) rows and checks data types. If fields were blank you'd get a string even if the column had 95% valid dates.
>
>Options were to load the first few rows with dates, or there was a registry change that could increase the default number of rows sampled (I've set it to 1000000 on a couple of servers).
>
>This may be handled the same way be .NET.
>
>I can't dig out the KB on it right at the minute..

Actually, I think I found it.

The Excel file had a header row in it. Even though I had formatted the columns as Date, they were still coming out empty. I took the header row out, and it worked fine. Go figure.
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Reply
Map
View

Click here to load this message in the networking platform