Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Questions about ADO

All -

Working the issue of a large data import, Google led me to ADO. I have
the basic routine working, copyied from a European website.

Right now I determine the size of the import afterwards via xlend etc.
Is there a property I can access before the import (rs.recordcount or
somesuch) that will tell me what the number of records is beforehand so
I can size the copied data? Easy enough for me to do except when I want
all of them. Second question--same for number of fields.

Right now, I count field.names while field(i).name < vbnullstring.
That gives an error, for which I continue on, and capture my counter. A
method that grates. What are the values of "empty" field.names? NULL
doesn't work either.


Thanks in advance.

....best, Hash
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Questions about ADO

Where rst is your recordset.

1. rst.RecordCount
-or-
you could do a query first to determine the number of rows which will
return.
select count(*) from my_table

2. rst.Fields.Count

ADO Programmers Reference:
http://msdn.microsoft.com/library/en...ireference.asp


--
Rob van Gelder - http://www.vangelder.co.nz/excel


wrote in message news:asYGd.18123$B95.5622@lakeread02...
All -

Working the issue of a large data import, Google led me to ADO. I have
the basic routine working, copyied from a European website.

Right now I determine the size of the import afterwards via xlend etc.
Is there a property I can access before the import (rs.recordcount or
somesuch) that will tell me what the number of records is beforehand so
I can size the copied data? Easy enough for me to do except when I want
all of them. Second question--same for number of fields.

Right now, I count field.names while field(i).name < vbnullstring.
That gives an error, for which I continue on, and capture my counter. A
method that grates. What are the values of "empty" field.names? NULL
doesn't work either.


Thanks in advance.

...best, Hash



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Questions about ADO

Hi Hash

Adding toRob: Note that recordcound won't work with cursor "ForwardOnly",
and that ForwardOnly is a lot faster than other cursors on certain systems.

HTH. Best wishes Harald

skrev i melding news:asYGd.18123$B95.5622@lakeread02...
All -

Working the issue of a large data import, Google led me to ADO. I have
the basic routine working, copyied from a European website.

Right now I determine the size of the import afterwards via xlend etc.
Is there a property I can access before the import (rs.recordcount or
somesuch) that will tell me what the number of records is beforehand so
I can size the copied data? Easy enough for me to do except when I want
all of them. Second question--same for number of fields.

Right now, I count field.names while field(i).name < vbnullstring.
That gives an error, for which I continue on, and capture my counter. A
method that grates. What are the values of "empty" field.names? NULL
doesn't work either.


Thanks in advance.

...best, Hash



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Questions about ADO


wrote:
Second question--same for number of fields.


rs.Fields.Count

Jamie.

--

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Questions about ADO

Very true - thanks Harald.

I also believe Server / Client side cursors will affect RecordCount.
Better to refer to the programmers reference and Provider documentation.
There is also a newsgroup devoted to ADO: microsoft.public.data.ado

To be honest, it's difficult remembering this stuff - I hardly ever deal
with ADO programming.
When I first started using ADO, I figured out what worked, wrote a wrapper
library and haven't touched it in years.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Harald Staff" wrote in message
...
Hi Hash

Adding toRob: Note that recordcound won't work with cursor "ForwardOnly",
and that ForwardOnly is a lot faster than other cursors on certain
systems.

HTH. Best wishes Harald

skrev i melding news:asYGd.18123$B95.5622@lakeread02...
All -

Working the issue of a large data import, Google led me to ADO. I have
the basic routine working, copyied from a European website.

Right now I determine the size of the import afterwards via xlend etc.
Is there a property I can access before the import (rs.recordcount or
somesuch) that will tell me what the number of records is beforehand so
I can size the copied data? Easy enough for me to do except when I want
all of them. Second question--same for number of fields.

Right now, I count field.names while field(i).name < vbnullstring.
That gives an error, for which I continue on, and capture my counter. A
method that grates. What are the values of "empty" field.names? NULL
doesn't work either.


Thanks in advance.

...best, Hash







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Questions about ADO

Harold, Rob, et al -

Thanks for the pointers and the website. rs.recordcount returned -1,
which the website says is a cursor problem. But with other methods
discussed there such as movenext to EOF and absolute size0 I got the
insight I needed.

Thanks again.
....best, Hash

In article ,
"Rob van Gelder" wrote:
Very true - thanks Harald.

I also believe Server / Client side cursors will affect RecordCount.
Better to refer to the programmers reference and Provider documentation.
There is also a newsgroup devoted to ADO: microsoft.public.data.ado

To be honest, it's difficult remembering this stuff - I hardly ever deal
with ADO programming.
When I first started using ADO, I figured out what worked, wrote a wrapper
library and haven't touched it in years.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Harald Staff" wrote in message
...
Hi Hash

Adding toRob: Note that recordcound won't work with cursor "ForwardOnly",
and that ForwardOnly is a lot faster than other cursors on certain
systems.

HTH. Best wishes Harald

skrev i melding news:asYGd.18123$B95.5622@lakeread02...
All -

Working the issue of a large data import, Google led me to ADO. I have
the basic routine working, copyied from a European website.

Right now I determine the size of the import afterwards via xlend etc.
Is there a property I can access before the import (rs.recordcount or
somesuch) that will tell me what the number of records is beforehand so
I can size the copied data? Easy enough for me to do except when I want
all of them. Second question--same for number of fields.

Right now, I count field.names while field(i).name < vbnullstring.
That gives an error, for which I continue on, and capture my counter. A
method that grates. What are the values of "empty" field.names? NULL
doesn't work either.


Thanks in advance.

...best, Hash





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
Answers to questions posing more questions in a workbook sbelle1 Excel Worksheet Functions 2 August 8th 09 01:02 AM
View Questions and Answer to questions I created Roibn Taylor Excel Discussion (Misc queries) 4 July 24th 08 12:05 AM
A few questions please help! mjay123 New Users to Excel 4 February 8th 06 08:04 PM
Two Questions mike New Users to Excel 2 June 24th 05 12:35 AM
two... two... two questions in one! Frank Kabel Excel Programming 8 February 8th 04 04:09 AM


All times are GMT +1. The time now is 07:06 AM.

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"