Updating datagrid vb net

01 May

The Find method returns the row with Customer Id = Tst ID.After that I assign values of the row and call the Data Adapter's Update method. Updating data using the Data Adapter's Update method Deleting a row is simple.This control is designed to be a complete solution for displaying tabular data with Windows Forms.Also the Data Grid View class allows us to customization of cells, rows, columns, and borders through the use of its properties You can extend the Data Grid View control in a number of ways to build custom behaviors into your applications.For example, if you call Delete on a row on the Data Set, then when Update is called on the Data Adapter, the Delete Command of the Data Adapter will be called using the particular row in the Data Set.Note: Keep in mind that this Update is different than a SQL UPDATE statement.All cells derive from the Data Grid View Cell base class.Each cell within the Data Grid View control can have its own style, such as text format, background color, foreground color, font etc.

All the source code in the following examples ,we chose the Pubs database, which comes with SQL Server , as our target database.

The way the architecture works with the Data Adapter is that you can make any changes you want to the filled Data Set, and it won't affect the database until you call the Update method.

When Update is called, the Data Adapter will attempt to execute each query (UPDATE, INSERT, DELETE) on every row of the Data Set that has been updated, inserted, and deleted.

As you saw in the Data Table, Data Row, and Data Column sections at the beginning of this article, you can use the Delete method of a Data Row to delete a row.

The Add New method of the Data Table adds a row to a Data Table.