<br /> //Getting Sheet Name<br /> Excel.ApplicationClass app = new ApplicationClass();<br /> Excel.Workbook workBook = app.Workbooks.Open(textFileName.Text, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, false, false);<br /> Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet;<br /> app.Visible = false;<br /> //-----------------------<br /> if (toolStripProgressBar1.Value == toolStripProgressBar1.Maximum)<br /> {<br /> toolStripProgressBar1.Value = toolStripProgressBar1.Minimum;<br /> }<br /> toolStripProgressBar1.PerformStep();<br /> string FileName = workSheet.Name;<br /> app.Workbooks.Close();<br /> <br /> string connectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + textFileName.Text + ";";<br /> connectionString += "Extended Properties=\"Excel 8.0;HDR=YES;\"";<br /> //<br /> OleDbCommand myCommand = new OleDbCommand("Select * from [" + FileName + "$];");<br /> OleDbConnection myConnection = new OleDbConnection(connectionString);<br /> myConnection.Open();<br /> myCommand.Connection = myConnection;<br /> OleDbDataReader myReader = myCommand.ExecuteReader();<br /> MessageBox.Show("hello");<br /> while(myReader.Read())<br /> {<br /> if (toolStripProgressBar1.Value == toolStripProgressBar1.Maximum)<br /> {<br /> toolStripProgressBar1.Value = toolStripProgressBar1.Minimum;<br /> }<br /> toolStripProgressBar1.PerformStep();<br /> <br /> TT_DT = myReader.GetDateTime(0);<br /> Subject = myReader.GetString(1);<br /> TT_ID = myReader.GetValue(2).ToString();<br /> <br /> LoadID(TT_DT, Subject, TT_ID);<br /> }<br /> myConnection.Close();<br />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)