comart
July 10th, 2001, 07:56 AM
Is the use of the bang when referencing a field name efficient?
strOldFirst = rstEmployees!fname
strOldFirst = rstEmployees!fname
|
Click to See Complete Forum and Search --> : Bang Efficiency comart July 10th, 2001, 07:56 AM Is the use of the bang when referencing a field name efficient? strOldFirst = rstEmployees!fname Cakkie July 10th, 2001, 08:02 AM It is as efficient as strOldFirst = rstEmployees("fname") strOldFirst = rstEmployees.fields!fname strOldFirst = rstEmployees.fields("fname") strOldFirst = rstEmployees.fields("fname").value cause eventually, when compiled, it all looks the same however, using the index number instead of the name will be faster, but less flexible when the recordset changes (like fields swapping place and stuff) strOldFirst = rstEmployees.Fields(0) Tom Cannaerts slisse@planetinternet.be Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook comart July 10th, 2001, 08:50 AM What does the bang actually do? Why use it? Iouri July 10th, 2001, 08:55 AM rs.(0) rs("Customer_Code") rs.fields(0) rs.fields("Customer_Code") rs.fields.item(0) rs.fields.item("Customer_Code") In VBScript, the versions that use field indexes instead of names are faster and the extended syntax-rs.fields. item(0)-is fastest. The reason: Although VBScript, like VB, supports default properties, VBScript doesn't have to search manually for the default property of the object being referenced. 'undocumented feature with rs .collect(fld1) .collect(fld2) end with works 30% faster then rs!Field Iouri Boutchkine iouri@hotsheet.com Cakkie July 10th, 2001, 08:58 AM don't know actually, I only know it can be used for reffering fields in a collection, don't even know if it can be used for all collections, or if it's only for recordsets Tom Cannaerts slisse@planetinternet.be Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |