Paul:

Couldn't you instead let the database do the heavy lifting for you? I mean,
just assume that in fact the user editted the unique field just fine, and
try to insert. If the database has the uniqueness requirement built in (and
I assume your database administrator wont let you near it without that..!)
then you will get a pretty specific error code/msg which you can then use to
convey this fact to the user..

Regards,
Geeta

Paul Barry wrote:

> When I am writing a form that updates a record in the database, the best
> practice is to pre-populate the form with the data from the database and
> then just update all of those values in the database, regardless of
> whether or not they have changed, right?  So what happens when you have
> a field that is required to be unique throughout the application, like a
> code or something?  I assume that before updating that record you need
> to do a select, to see if there already is another record in the
> database with that value, right?  So when the user changes that value to
> something that is already being used by another record, you can throw an
> exception like "code already in use".  But what happens if the user
> didn't modify that unique field?  The select will return a record, so
> the logic will already think there is already a user with that record.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to