DataTable dtExcelSheetName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
string getExcelSheetName = dtExcelSheetName.Rows[0]["Table_Name"].ToString();
cmd.CommandText = "SELECT * FROM [" + getExcelSheetName + "]";
ArrayList aList = new ArrayList();
foreach (DataRow row in dtExcelSheetName.Rows)
{
aList.Add(row);
}
drpSeletSheet.DataSource = aList;
for (int i = 1; i < dtExcelRecords.Rows.Count + 1; i++)
{
drpSeletSheet.Items.Add(dtExcelRecords.Rows[i]["Table_Name"].ToString());
}
drpSeletSheet.DataBind();
objAdapter1.SelectCommand = cmd;
objAdapter1.Fill(dtExcelRecords);