|
-
Apr 27th, 2005, 07:06 PM
#1
Thread Starter
Hyperactive Member
Record Set .RecordCount
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT * FROM pics"
rs.Open sql,objConn
response.write(rs.Fields("picture").Value)
i=rs.RecordCount
response.write("The number of records is: " & i)
rs.Close
what is wrong with the code above im am useing to get the number of records.
i want it to write 1 b/c there is one record in the table.
the SQL is defiantly right b/c response.write(rs.Fields("picture").Value) write out the value of the one thng in the database
but RecordCount is giveing me -1 why is this???
-
Apr 27th, 2005, 09:06 PM
#2
Member
Re: Record Set .RecordCount
What cursor style are you using? RecordCount only works with certian cursor styles, would be better off to use count() to get the record count.
-
Apr 27th, 2005, 09:08 PM
#3
Re: Record Set .RecordCount
When you dont pass the lock type and cursor type parameters the defualt is a forward only readonly recordset that
does not support the .Recordcount property.
Try using
rs.Open sql,objConn, adOpenKeyset, adLockOptimistic, adCmdText
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 
-
May 9th, 2005, 05:52 AM
#4
New Member
Re: Record Set .RecordCount
hi deae
fs
fsd
f
dsf
sd
sd
s
f
sf
sa
fsdsdfsafsfaf
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
|