[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

VB6 Recordset is empty when records exist in my View because of Group By

Posted on 2009-04-14
4
Medium Priority
?
377 Views
Last Modified: 2013-11-27
Hi
I'm programming with VBA for Excel, and I have a SELECT instruction that returns -1 RecordCount.

Here is my Slect Instruction :
RsPortes.Open "Select SONumber, NumSection, Qty, UniteMesure, ItemNumber, ItemName, DFTPICKINGLISTOPR FROM V_Portes WHERE V_Portes.SONumber='" & NumJob & "'", MaConnectionAxaptaData, adOpenDynamic, adLockOptimistic

The V_Portes is an SqlServer2005 view that is build with a Group By, it is working fine and getting the right results.

How can I get my recordset lines within VBA Excel code ?

Thanks  


0
Comment
Question by:venmarces
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 2000 total points
ID: 24142510
RsPortes.RecordCount is unreliable when you use adOpenDynamic.

If you just need to see whether there are rows, use RsPortes.EOF.

You can change to an adOpenStatic and adLockReadOnly and get RecordCount to behave -- assuming you don't need to write back to the recordset.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24142519
>that returns -1 RecordCount
that happens because you open on ServerSide instead of ClientSide cursor location, usually.

anyhow, do you really need the recordcount itself, or just if there are records or not => use bof and eof instead.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24143733
And in case you did not get the message:  The RecordCount property should not be used.
0
 

Author Closing Comment

by:venmarces
ID: 31570155
When I needed to get the RcordCount value of my Cursor I changed for adOpenStatic, adLockReadOnly and I was able to get the right value
Thanks for everybody  
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question