Hi
I used this code to check for a unique constraint voliation, whether it is best practices I'm not sure, I couldn't find another way at the time.
Catch ex As SqlException
'catch any errors
If ex.Number = 2627 Then 'catch error unique index contraint violated
MessageBox.Show(ex.message,Application.ProductName , MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show(ex.message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Duncan
|