DataGrid How to delete underlying database

T

Tom McL.

I have a datagrid bound to a database and
I would like to be able to select a row
programmable and then delete it.
I have been trying to use the OleDbDataAdapter1.DeleteCommand
but I can't figure out the syntax.

DataGrid1.Select(DataGrid1.CurrentRowIndex)
OleDbDataAdapter1.DeleteCommand ???????????
 
G

Guest

First of all: You're using the oledb dataadapter, so the delete syntax
depends on the underlying database you use.

The DeleteCommand is used within the dataadapter.Update method. I think you
cannot use it all alone (but I'm not quite sure).

So, the simplest way for you is to use the dataadapter wizard of Visual
Studio that will create you all of the commands used to.

After that, you can manually delete the row in your datasource (a datatable
normalliy) and the make a dataadapter.update.

Daniel
 

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