View Single Post
  #1   Report Post  
Bill Gates
 
Posts: n/a
Default

Thanks for the reply...

I get my data using the following code....

' set the connection string for the QueryTable
Sheets("Data").Range("VI").QueryTable.Connection = sSQLConn

' set the stored procedure to run
Sheets("Data").Range("VI").QueryTable.CommandText = "EXEC GetInformation" & sParameters

' execute the refresh of the data
Sheets("Data").Range("VI").QueryTable.Refresh BackgroundQuery:=False

Hope this helps

Bill
"Fredrik Wahlgren" wrote in message ...

"Bill Gates" wrote in message ...
Hello All,

I have a problem, I am sure that everyone in here has had this problem and I was hoping for some help to solve it.
I have checked the groups for a solution but was unable to find anything suitable.

Anyway on to the issue....

I have a datarange which retreives information from a SQL Server 2000 database, everything works fine when there is a lot or records returned, the problem occurs when just one record is returned.

I am doing a "DataRange.Rows.Count" which returns the correct number for large number of rows but returns 3 for just 1 row (i would have expected 2 as i have headers turn on)

see screen shot - the highlighted region is the datarange with one row return, as you can see there is a blank row under the return record. any ideas as to how to not return this record?



Thanks

Bill

How do you get your data? I guess DataRange.Rows.Count returns the size of the datarange which may be different from the number of records you get. If you use ADO, there's a property that tells you how many records you got.

/Fredrik