setelah kemaren udah nulis bagaimana cara menampilkan data di datagridview dari database kali ini saya mau share cara update data di datagridview dengan edit rows. jadi kaya sql server setiap kita edit rows otomatis data nya akan berubah di database
berikut codingan nya.
Imports System.Data.SqlClient
Public Class Form2
Const connectionstring As String = "Data Source=TOP;Initial Catalog=latihan;Persist Security Info=True;User ID=atm; password=atm"
Private SQL As String = "select * from siswa"
Private con As New SqlConnection(connectionstring)
Private dt As New DataTable
Private adapter As New SqlDataAdapter(Sql, con)
Private commandbuilder As New SqlCommandBuilder(adapter)
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
adapter.Fill(dt)
DataGridView1.DataSource = dt
End Sub
Private Sub DataGridView1_RowEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.RowEnter
adapter.Update(dt)
End Sub
Private Sub DataGridView1_RowLeave(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.RowLeave
adapter.Update(dt)
End Sub
End Class
sekian cara update data di Datagridview dengan edit rows di vbnet. silahkan download project nya di sini http://www.mediafire.com/download/cw025fdq0hinp2e/Datagridview+update+edit+rows.rar
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :