Import CSV

G

Guest

Hi,

when I load a CSV file into a DataSet, and try to display it in a gridView,
it clearly only displays the first column.
what am i forgetting?
this is my code

OleDbConnection ExcelConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pathName +
";Extended Properties='text;HDR=No;FMT=Delimited'");
//

OleDbCommand ExcelCommand = new OleDbCommand(@"SELECT * FROM " +
fileName, ExcelConnection);

OleDbDataAdapter ExcelAdapter = new OleDbDataAdapter(ExcelCommand);
ExcelConnection.Open();

DataSet ExcelDataSet = new DataSet();
ExcelAdapter.Fill(ExcelDataSet);

ExcelConnection.Close();
return ExcelDataSet;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top