views:

549

answers:

2

I have a WinForm that has a DataGridView table. It is bound to a DataTable in conjunction with a SqlDataAdapter and SqlCommandBuilder. What is the best way (easy and easy to manage) of disabling Deletes but allowing Selects, Updates, Inserts?

Is there a one line property I can set on the grid? That is how I would prefer to do it.

+2  A: 

Probably the easiest thing to do is to look over the properties on your DataGridView and change the AllowUserToDeleteRow to false.

RSolberg
How do you remove the delete command? The only way I can delete now is selecting the Row and hitting the "delete" keyboard button.
tyndall
I updated the answer a bit with the specific way of handling this.
RSolberg
+1 sweet thanks. By the way, is the "delete" key on the keyboard the only method supported of deleting... or did I miss something?
tyndall
I think in this example it is the only way of doing it. I tend to do more web forms vs. win forms programming and its a little different...
RSolberg
A: 

how to delete dataset record with datagridview connection sqldataadapter?

ahmad