Hmmmm .... interesting. Thanks Cathi ... it's not the way we're doing it, but no one says we're doing it the right way. <g> I guess there's more than one way to skin a cat ... it's nice to have several options.
~~Bonnie
>Hi Eric and Bonnie,
>
>You can update/add/delete DataRows using two approaches, either by writing your own statements or using stored procedures. One misconception in ADO.NET is that updates are batch processed. In actuality, each row is being sent separately to the backend when you call the DataAdapter's Update method.
>
>If your backend database supports batch queries (like SQL Server), then you can return from either a command statement or from a stored procedure, your updated row information. For a command statement, just append a SELECT statement to the end of your command statement, separating the two statements with a ";". Here is an example of an INSERT statement:
>
>
>MySqlInsertCommand.CommandText =
"INSERT INTO Employees(LastName, FirstName)
VALUES (@LastName, @FirstName);
SELECT EmployeeID, LastName, FirstName FROM Employees
WHERE (EmployeeID = @@IDENTITY)"
>
>
>For a Stored Procedure, you can use the following comparable code, still adding a Select statement:
>
>
>ALTER PROCEDURE dbo.SPInsertCommand
>(
> @LastName nvarchar(20),
> @FirstName nvarchar(10)
>)
>AS
> SET NOCOUNT OFF;
>INSERT INTO Employees(LastName, FirstName) VALUES (@LastName, @FirstName);
>
>SELECT EmployeeID, LastName, FirstName FROM Employees
> WHERE (EmployeeID = @@IDENTITY)
>
>
>When you run this, the DataAdapter knows to look for the results from the InsertCommand and the UpdateCommand because of its UpdatedRowSource property. This property accepts a value from the UpdateRowSource enumeration. By default, the Command will fetch new data from the modified row by checking for output parameters and the first row returned by the query.
>
>The DataSet will contain the updated information. Hope this helps.
>