carpe2 Posted February 8, 2008 Posted February 8, 2008 Hi, I´m trying to read a csv file. I think it is well-built and i wouldn´t like to use schema.ini to format it. I´m using the following: string connection = @"Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Path.GetDirectoryName(fileName) + ";" + "Extended Properties='text;HDR=YES;FMT=Delimited'"; // Select statement //string selectChargeback = "SELECT * FROM [" + excelSheet + "$]"; string selectChargeback = @"select * from [" + Path.GetFileName(fileName) + "]"; // Fill OleDbDataAdapter with the excel datasheet using (OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter(selectChargeback, connection)) { oleDbDataAdapter.Fill(dataTable); return dataTable; } Using this piece of code I get only the first column of the csv file with all its rows. Any idea why this is happening? Thanks in advance. Kind regards, Adolfo. Quote Adolfo.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.