By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,556 Members | 1,676 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,556 IT Pros & Developers. It's quick & easy.

DataGrid How to delete underlying database

P: n/a
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 ???????????

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
"Tom McL." wrote:
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 ???????????

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.