Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
X-Factor
Constraint Violating Yak Guru
392 Posts |
Posted - 2005-02-10 : 11:36:01
|
| Hi,I have a unique constraint on an e-mail address column. If this constraint is violated a .net exception is raised in code.How do I distinguish an exception raised as a result of a violation of this unique constraint from any other SQL provider exception?Do I have to do something as crude as check the error message for the name of the constraint?XF. |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-02-10 : 12:18:42
|
| ummm...yes?Unless you handle the check and pass out a user error...Brett8-) |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-02-10 : 13:13:35
|
| I'd check the msg ID rather than the text ie: 2627.As well as employ one of several techniques available to avoid the situation.Be One with the OptimizerTG |
 |
|
|
|
|
|