Yeah, I have the unique constraint in the DB, but you're right, there is
no easy way to trap the error. Your select statement makes sense, so I
will use that.
Bill Siggelkow wrote:
First of all, you probably want to enforce the UNIQUE constraint in the
database itself. As far as handling the
First of all, you probably want to enforce the UNIQUE constraint in the
database itself. As far as handling the validation, you can either trap
the SQL Exception and parse (though this approach is probably not very
portable and somewhat brittle). Or you can do a select that excludes
the curre
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
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 t
4 matches
Mail list logo