tags:

views:

206

answers:

2

How can I delete a row from a database with C#?

First I show the table content in a GridView, and I want to know how to delete the row I selected in the GridView (when I press the delete button) from the database.

+1  A: 

Deleting a column is not possible. You can delete a row ...

If you want to delete a column, you'll have to ALTER the table, and DROP the column, but I don't think that you will want your users to be able to do that ...

Perhaps you just want to hide the column in your GridView ?

Frederik Gheysels
+3  A: 

I think he means "row" not column.

If your grid is bound to a DataTable with a DataAdapter then you can call dataSet.dataTable.Rows[x].Delete() and then dataAdapter.Update() to reflect changes in DB.

More details here

In order to find out what x is (which row has the "arrow" as yout put it) check this

tzup