Data Adapter Update Command

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2008
Posts: 1
Reputation: hongpuay is an unknown quantity at this point 
Solved Threads: 0
hongpuay hongpuay is offline Offline
Newbie Poster

Data Adapter Update Command

 
0
  #1
Aug 5th, 2008
Hey, I face a problem in updating data to the original database.

Everytime when I clicked the update button. an error came out in the coding where I highlighted below, saying syntax error in update statement!

Can somebody please pin-point my mistake?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
         Me.JigTableAdapter.Fill(Me.JigDataSet.jig)

        con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\jig.mdb"
        con.Open()

        sql = "SELECT * FROM jig"
        da = New OleDb.OleDbDataAdapter(sql, con)

        da.Fill(ds, "jig")
        con.Close()

        MaxRows = ds.Tables("jig").Rows.Count
        inc = 0

    End Sub

Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
        Dim cb As New OleDb.OleDbCommandBuilder(da)

        ds.Tables("jig").Rows(inc).Item(0) = JIG_NOTextBox.Text()
        ds.Tables("jig").Rows(inc).Item(1) = JIG_NAMETextBox.Text()
        ds.Tables("jig").Rows(inc).Item(2) = JIG_MODELTextBox.Text()
        
        da.Update(ds, "jig")

        MsgBox("Data updated!")

    End Sub
Last edited by Ancient Dragon; Jan 5th, 2009 at 3:33 pm. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 628
Reputation: daviddoria is a jewel in the rough daviddoria is a jewel in the rough daviddoria is a jewel in the rough 
Solved Threads: 46
daviddoria daviddoria is offline Offline
Practically a Master Poster

Re: Data Adapter Update Command

 
0
  #2
Jan 4th, 2009
Please wrap your code in code tags.

I think you have to explicitly define an update command for the data adapter.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC