OVH Cloud OVH Cloud

RecordCount is lying to me...

5 réponses
Avatar
+The_Taco+
Ok i'm looping trought a SQL statement in VB. This statement make me loop my
recordset for about 53 times. But when I do the proprety
RecordSet.RecordCount, it returns something like 43. Is it possible that
.RecordCount isn't always right? If so, can anyone tell me why? Here's an
example of my stuff:

....
'I execute my query
....
Dim cpt as integer

cpt = RecordSet.RecordCount

Do While Not RecordSet.EOF


RecordSet.MoveNext
cpt = cpt + 1
Loop

5 réponses

Avatar
François Picalausa
"+The_Taco+" a écrit dans le message
de news:
Ok i'm looping trought a SQL statement in VB. This statement make me
loop my recordset for about 53 times. But when I do the proprety
RecordSet.RecordCount, it returns something like 43. Is it possible
that .RecordCount isn't always right? If so, can anyone tell me why?
Here's an example of my stuff:



Bonjour/soir,

Jette un oeil à la faq:
http://faq.vb.free.fr/index.php?question˜

Les informations s'appliquent aussi pour une valeur simplement erronée.

--
François Picalausa (MVP VB)
FAQ VB : http://faq.vb.free.fr
MSDN : http://msdn.microsoft.com
Avatar
Christian Hugoud - Xtrem7
Hi,

Try a MoveLast before using RecordCount.

Best Regards.

Christian Hugoud


"+The_Taco+" a écrit dans le message de
news:
Ok i'm looping trought a SQL statement in VB. This statement make me


loop my
recordset for about 53 times. But when I do the proprety
RecordSet.RecordCount, it returns something like 43. Is it possible


that
.RecordCount isn't always right? If so, can anyone tell me why? Here's


an
example of my stuff:

....
'I execute my query
....
Dim cpt as integer

cpt = RecordSet.RecordCount

Do While Not RecordSet.EOF


RecordSet.MoveNext
cpt = cpt + 1
Loop




Avatar
+The_Taco+
Thx for the help guys. For some reason, I didn't find the reason why the
.RecordCount proprety gave me wrong informations. Instead of using it, I did
use a count(*) query to do the task.

"Christian Hugoud - Xtrem7" a écrit dans le message de
news:bqftd6$352$
Hi,

Try a MoveLast before using RecordCount.

Best Regards.

Christian Hugoud


"+The_Taco+" a écrit dans le message de
news:
> Ok i'm looping trought a SQL statement in VB. This statement make me
loop my
> recordset for about 53 times. But when I do the proprety
> RecordSet.RecordCount, it returns something like 43. Is it possible
that
> .RecordCount isn't always right? If so, can anyone tell me why? Here's
an
> example of my stuff:
>
> ....
> 'I execute my query
> ....
> Dim cpt as integer
>
> cpt = RecordSet.RecordCount
>
> Do While Not RecordSet.EOF
>
>
> RecordSet.MoveNext
> cpt = cpt + 1
> Loop
>
>




Avatar
+The_Taco+
Whao, désolé pour l'anglais, je me croyais dans le forum VB anglais :P

"Christian Hugoud - Xtrem7" a écrit dans le message de
news:bqftd6$352$
Hi,

Try a MoveLast before using RecordCount.

Best Regards.

Christian Hugoud


"+The_Taco+" a écrit dans le message de
news:
> Ok i'm looping trought a SQL statement in VB. This statement make me
loop my
> recordset for about 53 times. But when I do the proprety
> RecordSet.RecordCount, it returns something like 43. Is it possible
that
> .RecordCount isn't always right? If so, can anyone tell me why? Here's
an
> example of my stuff:
>
> ....
> 'I execute my query
> ....
> Dim cpt as integer
>
> cpt = RecordSet.RecordCount
>
> Do While Not RecordSet.EOF
>
>
> RecordSet.MoveNext
> cpt = cpt + 1
> Loop
>
>




Avatar
Patrice Henrio
How do you do ? My tailor is rich but my english is poor.
"+The_Taco+" a écrit dans le message de
news:
Whao, désolé pour l'anglais, je me croyais dans le forum VB anglais :P

"Christian Hugoud - Xtrem7" a écrit dans le message


de
news:bqftd6$352$
> Hi,
>
> Try a MoveLast before using RecordCount.
>
> Best Regards.
>
> Christian Hugoud
>
>
> "+The_Taco+" a écrit dans le message de
> news:
> > Ok i'm looping trought a SQL statement in VB. This statement make me
> loop my
> > recordset for about 53 times. But when I do the proprety
> > RecordSet.RecordCount, it returns something like 43. Is it possible
> that
> > .RecordCount isn't always right? If so, can anyone tell me why? Here's
> an
> > example of my stuff:
> >
> > ....
> > 'I execute my query
> > ....
> > Dim cpt as integer
> >
> > cpt = RecordSet.RecordCount
> >
> > Do While Not RecordSet.EOF
> >
> >
> > RecordSet.MoveNext
> > cpt = cpt + 1
> > Loop
> >
> >
>
>