Vote UpVote

The Dangers of With

TPersistent.com – I have known about the dangers of using the with statement for a long time now.  Today, I encountered a new one.  I was refactoring code in a datamodule used to iterate over a dataset and insert each record into the database (a common construct).  The numerous ParamByName() calls were enclosed in a ‘with query do’ and I received a run-time error in a FieldByName() call.  The FieldByName() was to be called on the dataset which was not yet part of a with clause so it resolved to the query and of course the field didn’t exist.  A classic problem with using FieldByName() ...
Favorite? Off-Topic? Larry Hengen @ 2013-08-09 21:33


Visits: 871
Votes: 3
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Jeroen Pluimers
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)