public classExcelConn
{private stringFilePath;private string m_filePath = string.Empty;privateOleDbConnection conn;public ExcelConn(stringfilePath)
{this.FilePath =filePath;string fileType =System.IO.Path.GetExtension(filePath);if (fileType == ".xls")
{
conn= new OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source ='" + this.FilePath + "';Extended Properties=Excel 8.0;");
}else{
conn= new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source ='" + this.FilePath + "';Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\"");
}if (conn.State !=System.Data.ConnectionState.Open)
{
conn.Open();
}
}privateDataTable GetData(OleDbCommand cmd)
{try{if (cmd.Connection !=