public DataSet GetCSVFile( string fileName){ string pathName = System.IO. Path .GetDirectoryName(fileName); string file = System.IO. Path .GetFileName(fileName); OleDbConnection excelConnection = new OleDbConnection (@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ pathName + ";Extended Properties=Text;"); OleDbCommandexcelCommand = newOleDbCommand(@"SELECT * FROM "+ file, excelConnection); OleDbDataAdapterexcelAdapter = newOleDbDataAdapter(excelCommand); excelConnection.Open(); DataSetds = newDataSet(); excelAdapter.Fill(ds); excelConnection.Close(); return ds;}
Remember Me
Powered by: www.ie-soft.de
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2010, Manuel Trunk
E-mail