How to prohibit inserting existing row in datatable

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?
 
C

Cor

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
 
A

ardin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top