I am trying to convert my text file having TabDelimited data to Datatable, Text file data shown below:

Row1Col1 Row1Col2 Row1Col3 Row1Col4_0

Row2Col1 Row2Col2 Row2Col3 Row2Col4

Used Below code for conversion:

using (OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + file.DirectoryName + ";Extended Properties='text;CharacterSet=" + characterSet + ";HDR=No;FMT=TabDelimited';"))
    using (OleDbCommand cmd = new OleDbCommand(string.Format("SELECT * FROM [{0}]", file.Name), con))
    using (OleDbDataAdapter adp = new OleDbDataAdapter(cmd))
             DataTable tbl = new DataTable("MyTable");

It's showing me multi line value of column into different column.

closed as off-topic by Mokubai Nov 13 '18 at 9:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is not about computer hardware or software, within the scope defined in the help center." – Mokubai
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Programming questions are off topic here and should be asked on Stack Overflow. You should show how exactly the code is not working for you. – Mokubai Nov 13 '18 at 9:23

Browse other questions tagged or ask your own question.