Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static DataSet FirstColumn(string filename)
- {
- string filepath = filename;
- string sheetName = "First";
- //Oledb connection to generate excel in temporary folder on server
- string connectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + filepath + "';Extended Properties="Excel 12.0 Xml;HDR=YES;"";
- using (OleDbConnection conn = new OleDbConnection(connectionstring))
- {
- conn.Open();
- OleDbDataAdapter objDA = new System.Data.OleDb.OleDbDataAdapter
- ("select * from [" + sheetName + "$]", conn);
- DataSet excelDataSet = new DataSet();
- objDA.Fill(excelDataSet);
- return excelDataSet;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement