.NET Tidbits

I'm working on correcting a flaw in GenX.NET 3.0's CsvFormatProvider, where translating data fields that contain commas produces errors. In researching the problem, I found out two things:

  1. Excel handles quotes in CSV files and wraps it all into one cell. Example: [ "McLaws, Robert", test ] produces a spreadsheet with one row and two columns with the data:   | McLaws, Robert | test |
  2. When looking at the IDataReader interface docs to find out adding Data Type Checking to my formatting routines, I found the following pieces of info:
    • IDataRecord.GetDataTypeName - The data type information can differ from the type information returned by GetFieldType, especially where the underlying data types do not map one for one to the runtime types supported by the language. (e.g. DataTypeName may be "integer", while Type.Name may be "Int32".)
    • IDataRecord.GetFieldType - This information can be used to increase performance by indicating the strongly-typed accessor to call. (e.g. using GetInt32 is roughly ten times faster than using GetValue.)
Up to this point, I was under the assumption that adding a type-checking routine would only decrease performance. That was probably a very ignorant assumption.  Time to make some performance enhancements.
 
Now, on the CSV note, is there any way to specify a date format, maybe by enclosing it in # signs?

No Comments