Datagridview updating database

Hi Friend , Today we will learn "How to Perform Insert, Edit, Update, Delete and Cancel operations in Gridview Easily".

Here I have using Stored Procedure for this operations. For this You have to knowledge of Stored Procedure.

In this short snippet, we will populate a Data Grid View using the Load Data() method.

This method uses the Sql Data Adapter to populate a Data Set.

In the snippet below, we will be calculating the total of the ‘Freight’ field.

We will then display the data in a textbox by formatting the result (observe the To handle the Selected Index Changed event of a Data Grid View Combo Box, you need to use the Data Grid View. You can then retrieve the selected index or the selected text of the combobox.

The table ‘Orders’ in the Data Set is then bound to the Binding Source component which gives us the flexibility to choose/modify the data location.

Handle the User Deleting Row event to display a confirmation box to the user. If the user clicks cancel, set e.cancel = true which cancels the row deletion. Run(New Form1()) End Sub ' Initialize the form. Form Private data Grid View1 As New Data Grid View() Private binding Source1 As New Binding Source() Private data Adapter As New Sql Data Adapter() Private With Events reload Button As New Button() Private With Events submit Button As New Button() _ Public Shared Sub Main() Application. These questions have been collected from a variety of sources including some newsgroups, MSDN site and a few, answered by me at the MSDN forums.Data Grid View control is a Windows Forms control that gives you the ability to customize and edit tabular data. Consequently you can't scroll all the way to the bottom of the DGV using the scrollbar or the mouse wheel after reenabling the DGV (navigating with arrow keys still works, though.) So I'm looking for a workaround.

Tags: , ,