| View previous topic :: View next topic |
| Author |
Message |
Mitesh2004 Freshman
Joined: 26 Jan 2004 Posts: 43
|
Posted: Feb 9th, 2004 04:44 PM Post subject: Deleting using DataList |
|
|
Hello,
I have a DataList showing all the records in a database table. I am connecting using ADO. What code would i put to a button if i wanted the selected record in the list to be deleted when the button is clicked?
I would appreciate your help, Cheers! |
|
| Back to top |
|
Andir Centurion

Joined: 21 Dec 2003 Posts: 184 Location: Chicago Area
|
Posted: Feb 10th, 2004 12:55 AM Post subject: |
|
|
how are you binding your data to the list? Are you using ADO or the Data control? _________________ If you happen to see little people sitting on your desk...don't tell anyone or they might think your crazy too. |
|
| Back to top |
|
Mitesh2004 Freshman
Joined: 26 Jan 2004 Posts: 43
|
Posted: Feb 10th, 2004 04:47 AM Post subject: |
|
|
| I am using ADO |
|
| Back to top |
|
Andir Centurion

Joined: 21 Dec 2003 Posts: 184 Location: Chicago Area
|
Posted: Feb 10th, 2004 12:35 PM Post subject: |
|
|
If you set a recordset object, (ADODB.Recordset), you can use the delete method of that. The default flag is to delete just the selected record. You might have to requery the datagrid after deleting.
RS.Delete [optional AffectRecords] (default is current record)
MSDN: "...the records are marked for deletion from the cache and the actual deletion happens when you call the UpdateBatch method."
So if you want it to go away you'll also run the rs.UpdateBatch command. _________________ If you happen to see little people sitting on your desk...don't tell anyone or they might think your crazy too. |
|
| Back to top |
|
|