.net - Reading Comma Delimited Text File to C# DataTable, columns get truncated to 255 characters -


We are importing from CSV to SQL To do this, we are reading the CSV file and have a temporary .txt file Are using the schema ini. (I'm still not sure why this temporary file is being written, but in this way the code currently works). From there, we are loading datatables via OLEDB using the following connection string (for ASCII files).

  "Provider = Microsoft, J.A.L.D. 4.4; Data Source =" + Spat + "; Expanded Properties = \" Text; HDR = Yes; FMT = delimited \ "";  

Our problem is that fields with more than 255 characters are cut off. I've read about this problem online and it seems that the text field is sorted by default in this way Go.

I set my registry settings in ImportMixedTypes = Majority type and TypeGuessRows = 0 in HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Jet \ 4.0 \ Engines \ Excel \ / Code>, hopefully mycolumns will no longer be interpreted as text. After doing this, the temporary TXT file is being written correctly from the CSV file, but when I DataAdapter.Fill , the resulting datatile has a small value.

column definition in question CommaDelimited # txt Notes 2 false 234 true 130 0 0

Any help would be appreciated. At this time, I am not interested in using any 3D party code to solve this problem, there should be a method built in the tool.

The table definition here is:

   False & lt; / COLUMN_HASDEFAULT> & Lt; COLUMN_FLAGS & gt; 234 & lt; / COLUMN_FLAGS & gt; & Lt; IS_NULLABLE & gt; True & lt; / IS_NULLABLE & gt; & Lt; DATA_TYPE & gt; 130 & lt; / DATA_TYPE & gt; & Lt; CHARACTER_MAXIMUM_LENGTH & gt; 0 & lt; / CHARACTER_MAXIMUM_LENGTH & gt; & Lt; CHARACTER_OCTET_LENGTH & gt; 0 & lt; / CHARACTER_OCTET_LENGTH & gt; & Lt; / Column & gt;  

Thanks,

Greg


I tried to edit schema.ini specified text with a width, and with Did not get help (it was set to the first memo)

[CommaDelimited.txt] format = CSVDelimited DecimalSymbol =. Call 1 = Notes Text width 5000

Jet database engine makes the memo field smaller, The process is called on the basis of memo: aggregation, de-duplicating, formatting, and so on.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -