Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting

Post new topic   Reply to topic
Deleting using DataList
View previous topic :: View next topic  
Author Message
Mitesh2004
Freshman


Joined: 26 Jan 2004
Posts: 43

PostPosted: Feb 9th, 2004 04:44 PM    Post subject: Deleting using DataList Reply with quote

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
View user's profile Send private message Send e-mail
Andir
Centurion


Joined: 21 Dec 2003
Posts: 184
Location: Chicago Area

PostPosted: Feb 10th, 2004 12:55 AM    Post subject: Reply with quote

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
View user's profile Send private message
Mitesh2004
Freshman


Joined: 26 Jan 2004
Posts: 43

PostPosted: Feb 10th, 2004 04:47 AM    Post subject: Reply with quote

I am using ADO
Back to top
View user's profile Send private message Send e-mail
Andir
Centurion


Joined: 21 Dec 2003
Posts: 184
Location: Chicago Area

PostPosted: Feb 10th, 2004 12:35 PM    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic