Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to update a TableAdapter

How to update a TableAdapter

Scheduled Pinned Locked Moved Visual Basic
helpcsharpcssdatabase
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chatura Dilan
    wrote on last edited by
    #1

    Hi, I’m new to ADO.Net and I’m using VB.Net 2005. I have created a form which has a Data Grid, a ‘Show Data’ button and a ‘Update’ button. Also I have created a BindingSource, a TableAdapter and a DataSet. BindingSource is connected to an Access Database. I can get data by using Me.myTableTableAdapter.Fill(Me.DBDataSet.myTable) But when I tried to update the TabelAdapter Me.myTableTableAdapter.Update(Me.DBDataSet.myTable) I received an error “Update requires a valid UpdateCommand when passed DataRow collection with modified rows.” Then I double clicked the ‘DBDataSet.xsd’ on the Solution Explorer window and I selected myTableTableAdapter and created a new UpdateCommand Now I receive an error “Command text was not set for the command object.” I do not know what I have to do next:confused: Please Help me Thank you chatura

    M 1 Reply Last reply
    0
    • C Chatura Dilan

      Hi, I’m new to ADO.Net and I’m using VB.Net 2005. I have created a form which has a Data Grid, a ‘Show Data’ button and a ‘Update’ button. Also I have created a BindingSource, a TableAdapter and a DataSet. BindingSource is connected to an Access Database. I can get data by using Me.myTableTableAdapter.Fill(Me.DBDataSet.myTable) But when I tried to update the TabelAdapter Me.myTableTableAdapter.Update(Me.DBDataSet.myTable) I received an error “Update requires a valid UpdateCommand when passed DataRow collection with modified rows.” Then I double clicked the ‘DBDataSet.xsd’ on the Solution Explorer window and I selected myTableTableAdapter and created a new UpdateCommand Now I receive an error “Command text was not set for the command object.” I do not know what I have to do next:confused: Please Help me Thank you chatura

      M Offline
      M Offline
      mayhem_rules
      wrote on last edited by
      #2

      First create a command builder and then update the Data Adapter. Dim CB As New OLEDBCommandBuilder(myTableTableAdapter) Me.myTableTableAdapter.Update(Me.DBDataSet.myTable) With Best Regards, Mayur

      C 1 Reply Last reply
      0
      • M mayhem_rules

        First create a command builder and then update the Data Adapter. Dim CB As New OLEDBCommandBuilder(myTableTableAdapter) Me.myTableTableAdapter.Update(Me.DBDataSet.myTable) With Best Regards, Mayur

        C Offline
        C Offline
        Chatura Dilan
        wrote on last edited by
        #3

        When I try to do that I get a compilation error WindowsApplication2.DBDataSetTableAdapters.myTableTableAdapter' cannot be converted to 'System.Data.OleDb.OleDbDataAdapter'. WindowsApplication2 is my project name chatura -- modified at 0:46 Friday 10th March, 2006

        C 1 Reply Last reply
        0
        • C Chatura Dilan

          When I try to do that I get a compilation error WindowsApplication2.DBDataSetTableAdapters.myTableTableAdapter' cannot be converted to 'System.Data.OleDb.OleDbDataAdapter'. WindowsApplication2 is my project name chatura -- modified at 0:46 Friday 10th March, 2006

          C Offline
          C Offline
          Chatura Dilan
          wrote on last edited by
          #4

          Yes… I found the answer I haven’t created the Primary Key. chatura

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups