Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Importing data from the active sheet w/ c#
Hi,
i'm using this code to import data from an EXCEL file: oleConn = new OleDbConnection(strConn); oleConn.Open(); dtSchema = oleConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables , null); DataRow fRow = dtSchema.Rows[0]; TheSheet = fRow["TABLE_NAME"].ToString(); TheSheet = TheSheet.Substring(0, TheSheet.Length - 1); oleConn.Close(); if (!TheSheet.EndsWith("$")) TheSheet += "$"; OleDbDataAdapter myAdapter = new OleDbDataAdapter("SELECT * FROM [" + TheSheet+ "]", strConn); myAdapter.Fill(ds); The problem occurs when the first sheet (DataRow fRow = dtSchema.Rows[0];) is not the active one. So my question is ... in the code above, how can i get the actie sheet instead of the first one? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Weird Problem while Importing Data into another sheet | Excel Discussion (Misc queries) | |||
Importing Data from Multible Ranges in Excel Sheet | Excel Discussion (Misc queries) | |||
importing data from other sheet | Excel Discussion (Misc queries) | |||
importing data into sheet with subtotals | Excel Discussion (Misc queries) | |||
Copy from active sheet and paste into new sheet using info from cell in active | Excel Programming |