O'Reilly logo

Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition by David Sceppa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Submitting Updates Using Parameterized SqlCommands

Let’s set aside the SqlDataAdapter class for just a moment. As in the preceding simple snippets, you can already submit updates using parameterized SqlCommands.

Submitting a New Row

You can execute the following parameterized INSERT query to add a new row to your table. The syntax is straightforward. Specify the table name, a parameterized list of column names, and a parameterized list of parameters. For more information about the various options available on an INSERT query, see the documentation for your database’s query language.

INSERT INTO [Order Details] (OrderID, ProductID, Quantity, UnitPrice)
    VALUES (@OrderID, @ProductID, @Quantity, @UnitPrice)

In Chapter 4, you learned how to create a

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required