|
-
Jun 11th, 2008, 10:30 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Recordset recordcount returned -1
I'm query and store procedure.
After execute the query and retrieve data by using vb6.
I want to display the total rows returned from query.
I get the -1 value from recordset.recordcount.
Can anyone help me? thanks a million......
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
-
Jun 11th, 2008, 11:02 PM
#2
Addicted Member
Re: Recordset recordcount returned -1
What do you have now?, can I see the codes you are using?
-
Jun 11th, 2008, 11:26 PM
#3
Re: Recordset recordcount returned -1
It depends on the arguments you are passing when opening the recordset. Some will not suport the Recordcount property.
If your executing a SP and returning records from it to a recordset then you are creating a forward-only read-only recordset too.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 11th, 2008, 11:44 PM
#4
Member
Re: Recordset recordcount returned -1
i thing your table is not Primary Key that Reason for recordset can't Count the Number of Rows Insert the Primary and Run the Project if is Not Work Reply to Forums
-
Jun 12th, 2008, 12:09 AM
#5
Re: Recordset recordcount returned -1
Its not a primary key issue. Its an issue of the way the recordset is opened as only certain cursors and lock types support recordcount property.
http://support.microsoft.com/kb/194973
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 12th, 2008, 12:44 AM
#6
Thread Starter
Hyperactive Member
Re: Recordset recordcount returned -1
Thanks Roddog888 to give me some tips..
Therefore, What should I do to get the returned rows from query ?
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
-
Jun 12th, 2008, 12:58 AM
#7
PowerPoster
Re: Recordset recordcount returned -1
when you create your connection like this for example:
Code:
Dim con As adodb.Connection
Dim rs As adodb.Recordset
Set con = New ADODB.Connection
con.CursorLocation = adUseClient
con.Open your connection string here
setting the cursorlocation should solve the problem
-
Jun 12th, 2008, 01:09 AM
#8
Thread Starter
Hyperactive Member
Re: Recordset recordcount returned -1
Thanks Problem resolved ....
Thanks a million..
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
-
Jun 12th, 2008, 01:13 AM
#9
Thread Starter
Hyperactive Member
Re: [RESOLVED] Recordset recordcount returned -1
Furthermore , can someone explain to me the different btw adUseclient and adUseServer.
I hope someone can explain it to me :-)
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
-
Jun 12th, 2008, 03:13 AM
#10
Re: [RESOLVED] Recordset recordcount returned -1
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 12th, 2008, 05:40 AM
#11
Re: [RESOLVED] Recordset recordcount returned -1
I know this is a few hours late, but I've just finished an FAQ article on the RecordCount = -1 issue, which not only explains various solutions (and the pro's/con's of them), but also why you rarely need to know the RecordCount.
I don't know if you will find it useful, but here it is: Why does Recordcount sometimes equal -1?
-
Jun 12th, 2008, 05:53 AM
#12
Thread Starter
Hyperactive Member
Re: [RESOLVED] Recordset recordcount returned -1
thanks a lot for your article , i try to read it to understand the concept ....
:-)
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
-
Jun 12th, 2008, 02:37 PM
#13
Re: [RESOLVED] Recordset recordcount returned -1
Si, maybe adding my two previously posted links would be a good addition to your faq. Then I wont have to favorite the ms links.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 12th, 2008, 02:49 PM
#14
Re: [RESOLVED] Recordset recordcount returned -1
I looked at them with that thought in mind (as always!), but don't think they would add much... the CursorLocation one is just a copy of the help, and CursorType is already explained in this article for ADO: What do the parameters of the recordset.Open method mean? (I think my version is easier for people to understand, but you might disagree!).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|