Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2003, 04:42 PM
Registered User
 
Join Date: Jul 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to Add/Delete/Update multiple records in DB?

Hi All,

In a Master Details form, a user can modify multiple rows in the details grid. e.g. in a typical Invoice - Invoice Details scenario, where Invoice Details are shown in a grid, the user may add some rows, delete some rows and modify some rows.

My Q. is -- how to reconcile these changes to the database ?

Because uptil now, I was using the DataAdapter and setting various parameters (like InsertCommand.Parameters.Add or UpdateCommand.Parameters.Add ...) but by this, we can only add / update / delete a single record.

Please help.

Thanks and Regards,
Manoj Waikar.

 
Old September 20th, 2003, 11:41 AM
Registered User
 
Join Date: Sep 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Make use of the DataAdapter.Update() method which can accept DataTable or DataSet as a constructor arguement. The DataAdapter will examine the DataTable or DataSet for any changes and it will update the database by batch. This assumes that you already defined your updating logic in the DataAdapter's SelectCommand, UpdateCommand, DeleteCommands, InsertCommand properties. All this properties accept/return Command objects which you are already comfortable working with.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Add/Update/Delete Database records MANUALLY jn148 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 December 14th, 2008 10:18 AM
How to delete the Multiple Records Using Checkbox tks_muthu Classic ASP Databases 4 February 10th, 2005 03:19 AM
Multiple Delete Records With CheckBox XXL Classic ASP Basics 5 December 29th, 2004 08:46 PM
How Can I Delete Multiple Records From a Table? Lucy SQL Server 2000 5 May 12th, 2004 05:20 AM
Update or add multiple table records rosenzl VB.NET 3 June 12th, 2003 01:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.