C# Tabdelimited text File with multiple column to datatable [on hold]
up vote
1
down vote
favorite
I am trying to convert my text file having TabDelimited data to Datatable, Text file data shown below:
Row1Col1 Row1Col2 Row1Col3 Row1Col4_0
Row1Col4_1
Row1Col4_2
Row2Col1 Row2Col2 Row2Col3 Row2Col4
Row2Col2
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))
{
con.Open();
using (OleDbDataAdapter adp = new OleDbDataAdapter(cmd))
{
DataTable tbl = new DataTable("MyTable");
adp.Fill(tbl);
}
}
}
It's showing me multi line value of column into different column.
c# asp.net textfiles asp
New contributor
put on hold as off-topic by Mokubai♦ 2 days ago
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.
add a comment |
up vote
1
down vote
favorite
I am trying to convert my text file having TabDelimited data to Datatable, Text file data shown below:
Row1Col1 Row1Col2 Row1Col3 Row1Col4_0
Row1Col4_1
Row1Col4_2
Row2Col1 Row2Col2 Row2Col3 Row2Col4
Row2Col2
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))
{
con.Open();
using (OleDbDataAdapter adp = new OleDbDataAdapter(cmd))
{
DataTable tbl = new DataTable("MyTable");
adp.Fill(tbl);
}
}
}
It's showing me multi line value of column into different column.
c# asp.net textfiles asp
New contributor
put on hold as off-topic by Mokubai♦ 2 days ago
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♦
2 days ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am trying to convert my text file having TabDelimited data to Datatable, Text file data shown below:
Row1Col1 Row1Col2 Row1Col3 Row1Col4_0
Row1Col4_1
Row1Col4_2
Row2Col1 Row2Col2 Row2Col3 Row2Col4
Row2Col2
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))
{
con.Open();
using (OleDbDataAdapter adp = new OleDbDataAdapter(cmd))
{
DataTable tbl = new DataTable("MyTable");
adp.Fill(tbl);
}
}
}
It's showing me multi line value of column into different column.
c# asp.net textfiles asp
New contributor
I am trying to convert my text file having TabDelimited data to Datatable, Text file data shown below:
Row1Col1 Row1Col2 Row1Col3 Row1Col4_0
Row1Col4_1
Row1Col4_2
Row2Col1 Row2Col2 Row2Col3 Row2Col4
Row2Col2
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))
{
con.Open();
using (OleDbDataAdapter adp = new OleDbDataAdapter(cmd))
{
DataTable tbl = new DataTable("MyTable");
adp.Fill(tbl);
}
}
}
It's showing me multi line value of column into different column.
c# asp.net textfiles asp
c# asp.net textfiles asp
New contributor
New contributor
New contributor
asked 2 days ago
Pratik
62
62
New contributor
New contributor
put on hold as off-topic by Mokubai♦ 2 days ago
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.
put on hold as off-topic by Mokubai♦ 2 days ago
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♦
2 days ago
add a comment |
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♦
2 days ago
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♦
2 days ago
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♦
2 days ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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♦
2 days ago