|
-
Aug 12th, 2004, 10:20 AM
#1
rs!FieldName or rs.Fields("FieldName")
Ok, I forget. Which is the faster or better way of getting a value from a recordset?
rs!FieldName or rs.Fields("FieldName")
-
Aug 12th, 2004, 10:25 AM
#2
Allegedly, it's supposed to be the ! format, but I don't see how or why, and it always makes me nervous. I usualy opt for the .FIelds() route.
TG
-
Aug 12th, 2004, 02:44 PM
#3
PowerPoster
I always use the ! method. I think it more a matter of what you are comfortable with.
-
Aug 12th, 2004, 03:15 PM
#4
I heard that the .Fields was faster performing
so I changed over to using it that way.
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 
-
Aug 13th, 2004, 03:21 AM
#5
I prefer rst("field name")...
As to the speed - no idea, should be negligable anyway.
If it is a major speed difference, please post up so I can change 
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Aug 13th, 2004, 06:36 AM
#6
Hyperactive Member
I always use rs.fields("fieldname"). Like Vince says, I'm sure any difference will be undetectable. Unless anyone knows different!
The Bloke
www.blokeinthekitchen.com
making cooking cool for blokes
-
Aug 13th, 2004, 10:22 AM
#7
New Member
I think I ran into problems when using ! in the past - for example if a field name contained unusual characters, this caused the VB IDE a bit of grief. Obviously a well designed database shouldn't use weird character sets for field names, but I was linking to a third party database, and didn't have any control over it.
Another possible reason to stick to .Fields("name") is to future proof your code - I think the .NET code conversion utility ignores !, (at least it did in the early versions, MS might have addressed this now).
George
-
Aug 16th, 2004, 01:10 AM
#8
MS Told me that using ordinals is faster.
objrs.Fields(0).Value > objrs.Fields("fieldname") > objrs!fieldname
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
|