String filePath = Setting. SourcePath;
String sheetName = Setting. SourceFile;
String strConn = "";
StrConn = (@ "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" + filePath + "; Extended Properties = Text ");
If (! This. isOpened)
MyOleDbConnection = new OleDbConnection (strConn );
Try
{
MyOleDbConnection. Open ();
IsOpened = true;
// Get all sheets
// DataTable dataTable = myOleDbConnection. GetOleDbSchemaTable (System. Data. OleDb. OleDbSchemaGuid. Tables, null );
// Foreach (System. Data. DataRow drow in dataTable. Rows)
//{
// SheetName = drow ["Table_Name"]. ToString ();
// DataTable tableColumns = myOleDbConnection. GetOleDbSchemaTable (OleDbSchemaGuid. Columns, new object [] {null, null, sheetName, null });
// Break;
//}
OleDbCommand myOleDbCommand = new OleDbCommand ("SELECT * FROM" + sheetName, myOleDbConnection );
DataReader = myOleDbCommand. ExecuteReader ();