Hello Frens,
I tried to update change made in database shown DataGridView1 of Visual Studio 2008 with the following codes. But an error message comes as "Object reference not set to an instance of an object".
Public Class Form1
Dim cmd As Odbc.OdbcCommand
Dim adp As Odbc.OdbcDataAdapter
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Db1DataSet.Table1' table. You can move, or remove it, as needed.
Me.Table1TableAdapter.Fill(Me.Db1DataSet.Table1)
'TODO: This line of code loads data into the 'Db1DataSet.Table1' table. You can move, or remove it, as needed.
Me.Table1TableAdapter.Fill(Me.Db1DataSet.Table1)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Update records using a Command Builder
' The variable i gives the number of records updated
Dim cmdbuilder As New Odbc.OdbcCommandBuilder(adp)
Dim i As Integer
Try
i = adp.Update(Db1DataSet, "Table1")
MsgBox("Records Updated= " & i)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
Plz help me