[c#]datagridviewcells value before insert in db

Hi again.

On unbound datagridview on a form made with designer, i put some values in cells and with a command button this values are stored in database.

Now, how can i control before the insert, if some values already are stored in the database

For ex.:

my values in cells are:

row[0]:  1    5    7

i need to control before insert that in the table of db, at relative column and row, that values are already stored and so, i need to prevent user to create a new row in database.

I cant bind datagridview with table before insert because i need to set the rowcount property of datagridview, which is not possible with bound dgv.

Is it possible

Thx a lot.


Answer this question

[c#]datagridviewcells value before insert in db

  • Chimme

    Try add handler for CellEndEdit event.

  • K.S.RamakrishnaPrasanna

    Hi :)

    I've already the handler for cell end edit, but my problem is that i need to do something like that:

    DAY CUSTOMER IN OUT

    1 Raoul 9.30 12.30


    I need to prevent that if the user try to insert for the same day and the same customer, the same "IN" and "OUT" the application stop the insert into database.

    Thx :)

  • [c#]datagridviewcells value before insert in db