I am new to VB 2005. I have created a new form in VB.NET 2005 and placed datagridview on the form.
its property AllowUserToAddRows is set to true and placed a button on form. It shows data on the grid properly and allows to add rows but these rows are not reflected in database table. how can I Add new Rows to Datagridview dynamically and these new rows should be Added in database table automatically just like in datagrid in VB6. I also want whenever any cell is updated its values should be updated in database table. How can we make some columns editable and others are not.
Public Class Form1
Private LawCon As SqlConnection
Private LawDa As SqlDataAdapter
Private LawDs As DataSet
Private Lawcmd As SqlCommand
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
LawCon = New SqlConnection("server=MITTAL;uid=sa;pwd=;database=mys")
LawDa = New SqlDataAdapter("select * from Law1", LawCon)
LawDs = New DataSet()
DataGridView1.DataSource = LawDs.Tables("Laws")