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. problems insert data in database using table adapter

problems insert data in database using table adapter

Scheduled Pinned Locked Moved Visual Basic
databasequestionannouncement
6 Posts 3 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.
  • A Offline
    A Offline
    AAGTHosting
    wrote on last edited by
    #1

    When I do a database insert there are no errors displayed, but when I check the database the data does not insert into the database. Why? Here is my code. I declared addRow globally. addRow = lpDataSet.Tables("tbl_students").NewRow() addRow("stud_cell") = txtStudCell.Text addRow("stud_phone") = txtStudPhone.Text lpDataSet.Tables("tbl_students").Rows.Add(addRow) Try studTableAdapter.Update(addRow) Catch err As Exception MessageBox.Show(err.Message) End Try

    K S 2 Replies Last reply
    0
    • A AAGTHosting

      When I do a database insert there are no errors displayed, but when I check the database the data does not insert into the database. Why? Here is my code. I declared addRow globally. addRow = lpDataSet.Tables("tbl_students").NewRow() addRow("stud_cell") = txtStudCell.Text addRow("stud_phone") = txtStudPhone.Text lpDataSet.Tables("tbl_students").Rows.Add(addRow) Try studTableAdapter.Update(addRow) Catch err As Exception MessageBox.Show(err.Message) End Try

      K Offline
      K Offline
      Karrar Ketawi
      wrote on last edited by
      #2

      Try this code addRow = lpDataSet.Tables("tbl_students").NewRow() addRow("stud_cell") = txtStudCell.Text addRow("stud_phone") = txtStudPhone.Text lpDataSet.Tables("tbl_students").Rows.Add(addRow) Try studTableAdapter.Update() Catch err As Exception MessageBox.Show(err.Message) End Try :-\

      A 1 Reply Last reply
      0
      • K Karrar Ketawi

        Try this code addRow = lpDataSet.Tables("tbl_students").NewRow() addRow("stud_cell") = txtStudCell.Text addRow("stud_phone") = txtStudPhone.Text lpDataSet.Tables("tbl_students").Rows.Add(addRow) Try studTableAdapter.Update() Catch err As Exception MessageBox.Show(err.Message) End Try :-\

        A Offline
        A Offline
        AAGTHosting
        wrote on last edited by
        #3

        When I take the dataRow variable out of the table adapter update function I get the blue line. The error says the following.

        Overload resolution failed because no accesdsible update accepts this number of arguments.

        Why wont the update update or add a row to the database with or without the dataRow variable as an argument?

        K 1 Reply Last reply
        0
        • A AAGTHosting

          When I take the dataRow variable out of the table adapter update function I get the blue line. The error says the following.

          Overload resolution failed because no accesdsible update accepts this number of arguments.

          Why wont the update update or add a row to the database with or without the dataRow variable as an argument?

          K Offline
          K Offline
          Karrar Ketawi
          wrote on last edited by
          #4

          Oops :doh: Sorry addRow = lpDataSet.Tables("tbl_students").NewRow() addRow("stud_cell") = txtStudCell.Text addRow("stud_phone") = txtStudPhone.Text lpDataSet.Tables("tbl_students").Rows.Add(addRow) Try studTableAdapter.Update(lpDataSet, "tbl_students" ) Catch err As Exception MessageBox.Show(err.Message) End Try

          A 1 Reply Last reply
          0
          • K Karrar Ketawi

            Oops :doh: Sorry addRow = lpDataSet.Tables("tbl_students").NewRow() addRow("stud_cell") = txtStudCell.Text addRow("stud_phone") = txtStudPhone.Text lpDataSet.Tables("tbl_students").Rows.Add(addRow) Try studTableAdapter.Update(lpDataSet, "tbl_students" ) Catch err As Exception MessageBox.Show(err.Message) End Try

            A Offline
            A Offline
            AAGTHosting
            wrote on last edited by
            #5

            You can't put the name of a dataset coma the name of a table.

            1 Reply Last reply
            0
            • A AAGTHosting

              When I do a database insert there are no errors displayed, but when I check the database the data does not insert into the database. Why? Here is my code. I declared addRow globally. addRow = lpDataSet.Tables("tbl_students").NewRow() addRow("stud_cell") = txtStudCell.Text addRow("stud_phone") = txtStudPhone.Text lpDataSet.Tables("tbl_students").Rows.Add(addRow) Try studTableAdapter.Update(addRow) Catch err As Exception MessageBox.Show(err.Message) End Try

              S Offline
              S Offline
              Sourie
              wrote on last edited by
              #6

              Maybe it needs AcceptChanges method for that table.

              Sourie

              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