Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
ExecuteReader on empty Excel range hangs
With VB.NET (Visual Studio 2005), I am trying to read a range of cells from
an Excel-sheet, where the first rows and columns are empty. It's a sheet I just created in Excel, so there has never been data in the first rows and columns before. The actual data in the sheet starts at C4. When I try to read a block of values which contains only empty cells, f.e. A1:B2, ExecuteReader hangs. Here is my code: Dim ExcelConnectionString As String Dim ExcelConnection As OleDbConnection ExcelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" ExcelConnectionString += "C:\Temp\Test1.xls" ExcelConnectionString += ";Extended Properties=""Excel 8.0;HDR=NO;IMEX=1""" ExcelConnection = New OleDbConnection(ExcelConnectionString) ExcelConnection.Open() Dim command As New OleDbCommand("SELECT * FROM [Sheet1$A1:B2]", ExcelConnection) Dim reader As OleDbDataReader reader = command.ExecuteReader() When I open Excel, add values to the above range, then remove these values and start the code again, the code works fine, the reader contains no rows and that's what I want. Does anyone know what's happening here? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 hangs on any change to large range of data | Excel Discussion (Misc queries) | |||
Finding next empty empty cell in a range of columns | Excel Programming | |||
Excel macro convert to VBA - doesn't work, hangs on Range("Q35").Select | Excel Programming | |||
Excel Hangs | Excel Discussion (Misc queries) | |||
How do I refer to a non-empty row range in Excel | Excel Discussion (Misc queries) |