How to prohibit inserting existing row in datatable

  • Thread starter Thread starter ardin
  • Start date Start date
A

ardin

suppose i have a dataset populated using dataadapter. i bind the dataset
to a windows datagrid. i accepts new record through textboxes not
through the datagrid. how can i detect if the data entered is already
existing to the dataset before the update command of the dataset is
executed so that the row with error will not be added to the datagrid?
 
Hi Ardin,

You can use the datatable select
You can use the datarowcollection find
You can use the dataview rowfilter
You can go through the datatable with a loop

I hope this helps?

Cor
 
cor,

thanks, i actually use dataview rowfilter, however, i just want to know
if there's another way, like when i issue that command
dataset.table["tablename"].rows.add(dRow), an exeption will be generated
since the primary/unique key is already included in the dataset schema.

again thanks,

ardin
 
Back
Top