Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 hangs on any change to large range of data shoemaven Excel Discussion (Misc queries) 3 November 9th 07 08:57 PM
Finding next empty empty cell in a range of columns UncleBun Excel Programming 1 January 13th 06 11:22 PM
Excel macro convert to VBA - doesn't work, hangs on Range("Q35").Select Harold Good Excel Programming 3 January 13th 06 09:09 PM
Excel Hangs Linda Excel Discussion (Misc queries) 2 October 4th 05 04:36 PM
How do I refer to a non-empty row range in Excel Henry San Diego Excel Discussion (Misc queries) 1 June 2nd 05 09:06 PM


All times are GMT +1. The time now is 04:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"