PC Review


Reply
Thread Tools Rate Thread

DataGrid How to delete underlying database

 
 
Tom McL.
Guest
Posts: n/a
 
      31st Mar 2005
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 ???????????



 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGFuaWVsIENoLiBCbG9jaA==?=
Guest
Posts: n/a
 
      31st Mar 2005
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 ???????????
>
>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot seem to update underlying DataAdapter with Values in Datagrid gmartin@dsgsolutions.net Microsoft Dot NET Framework Forms 3 14th Aug 2008 05:57 PM
How to select known DataRow from underlying DataTable on DataGrid (WinForms) Bajgon Microsoft C# .NET 2 6th Dec 2004 04:37 PM
Add row to datagrid without underlying table? Jim Microsoft C# .NET 5 29th Jul 2004 03:44 PM
How to access underlying dataset from DataGrid control =?Utf-8?B?U2Vhbg==?= Microsoft VB .NET 1 23rd Jan 2004 10:04 PM
How do you map an arbitrary datagrid row to the underlying row in the data table. Mark Sundsten Microsoft Dot NET Framework Forms 0 18th Nov 2003 12:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:00 AM.