Update problem in DataGrid

abhit_kumar

Member
Joined
Aug 13, 2008
Messages
19
Programming Experience
Beginner
Dear Experts,

Please see the following code for updating rows of DataGridView in VB.Net.
VB.NET:
Private Sub Update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Update.Click

        Dim con As New SqlConnection
        Dim com As New SqlCommand
        Dim ds As New DataSet

        Dim adap As New SqlDataAdapter
        con = New SqlConnection("server=localhost;uid=sa;pwd=********;database=FS Project")
        con.Open()
        adap = New SqlDataAdapter("select * from InwardMaster", con)
        adap.Fill(ds, "InwardMaster")
        adap.Update(ds, "InwardMaster")

        Dim item As New DataGridViewRow
        DataGridView1.AllowUserToAddRows = True
        item.CreateCells(DataGridView1)
    End Sub
When i click to Submit button, its doesnt update the changed rows.

Please help me, how to do this?

Regards,
AKM
 
Back
Top