HI
IN MY VB.NET 2005 APPLICATION, I placed one datagridview conntrol.
This control is filled from from a table(single table involved) using datatable and dataadapter.
I want to edit the the data in the grid and and pass changes to the table direclty.
user can change data in the gird but not get reflected the changes in the database.
I even tried even MSDN sample code for filling the datagridview, but still not working
Post the error, and code of what you've tried. It's easier to bind controls than not, but you can also NOT update a record. It depends on what you've done so far...
using the following code I initialise my grid
gird is filled, I want user to edit the columns, could add new rows, delete exisiting one.
Grid is editable, but not reflected into the database
Dim dt1 As New DataTable, adptr1 As New SqlDataAdapter ' declared at class objects
Private Sub InitializeDataGridView()
Try
' Set up the DataGridView.
With Me.DataGridView2
' Automatically generate the DataGridView columns.
.AutoGenerateColumns = True
' Automatically resize the visible rows.
.AutoSizeRowsMode = _
DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders
' Set the DataGridView control's border.
.BorderStyle = BorderStyle.Fixed3D
' Put the cells in edit mode when user enters them.
.EditMode = DataGridViewEditMode.EditOnEnter
End With
Catch ex As SqlException
MessageBox.Show(ex.Tomessage)
System.Threading.Thread.CurrentThread.Abort()
End Try
End Sub
Bookmarks