i have one code and i have to find the table from which the data have been retrieved here is the code
- private static DataSet ImportExcelXLS(string FileName, bool hasHeaders)
- {
- string HDR = hasHeaders ? "Yes" : "No";
- string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileName + ";Extended Properties=\"Excel 8.0;HDR=" + HDR + ";IMEX=1\"";
- DataSet output = new DataSet();
- using (OleDbConnection conn = new OleDbConnection(strConn))
- {
- conn.Open();
- DataTable dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
- foreach (DataRow row in dt.Rows)
- {
- string sheet = row["TABLE_NAME"].ToString();
- OleDbCommand cmd = new OleDbCommand("SELECT * FROM [" + sheet + "]", conn);
- cmd.CommandType = CommandType.Text;
- DataTable outputTable = new DataTable(sheet);
- output.Tables.Add(outputTable);
- new OleDbDataAdapter(cmd).Fill(outputTable);
- }
- }
- return output;
- }

Salman BegPosted Feb 27, 2019, 1:10 AM
Subin ThomasPosted Feb 27, 2019, 1:00 AM
Salman BegPosted Feb 27, 2019, 12:58 AM
Subin ThomasPosted Feb 27, 2019, 12:56 AM
Subin ThomasPosted Feb 27, 2019, 12:52 AM
Subin ThomasPosted Feb 27, 2019, 12:52 AM
Madan ShekarPosted Feb 27, 2019, 12:45 AM
Madan ShekarPosted Feb 27, 2019, 12:44 AM
Salman BegPosted Feb 27, 2019, 12:43 AM