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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. error source is System.DataUpdate for da.update command in vb.net...pls help

error source is System.DataUpdate for da.update command in vb.net...pls help

Scheduled Pinned Locked Moved Visual Basic
helpcsharpannouncement
2 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.
  • K Offline
    K Offline
    kamalika_kk
    wrote on last edited by
    #1

    please go through the following code...i'v tried to apply the disconnected mode using dataset and data adapter...it's givng an error of this fashion... "System.DataUpdate requires a valid Insertcommand when passed DataRow collection with new row" for the da.update command in addcmd_click event......please help Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim con As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Documents and Settings\Administrator\Desktop\exp_mod\exp.mdb;" cn.ConnectionString = con dao = New OleDbDataAdapter("select * from exp_mas_bank", cn) dao.Fill(ds, "bank") End Sub Private Sub addcmd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addcmd.Click Dim drs As DataRow = ds.Tables("bank").NewRow drs(0) = cdtxt.Text drs(1) = nmtxt.Text drs(2) = addtxt.Text ds.Tables("bank").Rows.Add(drs) Try dao.Update(ds, "bank") Catch ex As Exception MsgBox(ex.Source & ex.Message) End Try End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ds.Tables("bank").Rows(0)("code") = ds.Tables("bank").ToString & " ***" Try cn.Open() dao.Update(ds, "bank") cn.Close() Catch ex As Exception MsgBox(ex.Source & ex.Message) End Try End Sub:(

    R 1 Reply Last reply
    0
    • K kamalika_kk

      please go through the following code...i'v tried to apply the disconnected mode using dataset and data adapter...it's givng an error of this fashion... "System.DataUpdate requires a valid Insertcommand when passed DataRow collection with new row" for the da.update command in addcmd_click event......please help Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim con As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Documents and Settings\Administrator\Desktop\exp_mod\exp.mdb;" cn.ConnectionString = con dao = New OleDbDataAdapter("select * from exp_mas_bank", cn) dao.Fill(ds, "bank") End Sub Private Sub addcmd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addcmd.Click Dim drs As DataRow = ds.Tables("bank").NewRow drs(0) = cdtxt.Text drs(1) = nmtxt.Text drs(2) = addtxt.Text ds.Tables("bank").Rows.Add(drs) Try dao.Update(ds, "bank") Catch ex As Exception MsgBox(ex.Source & ex.Message) End Try End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ds.Tables("bank").Rows(0)("code") = ds.Tables("bank").ToString & " ***" Try cn.Open() dao.Update(ds, "bank") cn.Close() Catch ex As Exception MsgBox(ex.Source & ex.Message) End Try End Sub:(

      R Offline
      R Offline
      Ritesh1234
      wrote on last edited by
      #2

      Hi kamalika, Before calling dao.Update to insert/update or delete data from Dataset to database you have to set the dao.InsetCommand,dao.UpdateCommand and dao.DeleteCommand property with approriate command Regards, Ritesh

      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