Array
(
)

tratar erro ao att gridview

Paulo Costa
   - 25 mar 2010

O seguinte erro dá quando tiro o focus da linha que estou inserindo na base.   queria saber onde tratar e informar ao usuario que ja existe um cadastro com esse nome de logon :)   no aguardo.    

---------------------------
DataGridView Default Error Dialog
---------------------------
The following exception occurred in the DataGridView:

 

System.Data.ConstraintException: Column 'logon' is constrained to be unique.  Value 'paulovitor' is already present.

   at System.Data.UniqueConstraint.CheckConstraint(DataRow row, DataRowAction action)

   at System.Data.DataTable.RaiseRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction, Boolean fireEvent)

   at System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Boolean suppressEnsurePropertyChanged, Int32 position, Boolean fireEvent, Exception& deferredException)

   at System.Data.DataTable.InsertRow(DataRow row, Int64 proposedID, Int32 pos, Boolean fireEvent)

   at System.Data.DataView.FinishAddNew(Boolean success)

   at System.Data.DataRowView.EndEdit()

   at System.Windows.Forms.CurrencyManager.EndCurrentEdit()

   at System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowValidating(DataGridViewCellCancelEventArgs e)

 

To replace this default dialog please handle the DataError event.
---------------------------
OK  
---------------------------