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. Regarding updation in Datagrid-----Urgently

Regarding updation in Datagrid-----Urgently

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasehelpannouncement
5 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.
  • V Offline
    V Offline
    venkata lakshmi prasanna
    wrote on last edited by
    #1

    Iam new to VB.Net2005. In the Form Load Event Iam Displaying Data into Datagridviewand I have written a code for Double-click event which is going to disply the data in the relevent textboxes from datagridview. After Displaying I want to modify the Data and updating it into the Database. For this I have written the code as: ds.Tables("emp_details").Rows(n).Item(1) = txtsurname.Text ds.Tables("emp_details").Rows(n).Item(2) = txtname.Text ds.Tables("emp_details").Rows(n).Item(3) = txtdesg.Text ds.Tables("emp_details").Rows(n).Item(4) = txtplace.Text ds.Tables("emp_details").Rows(n).Item(5) = txteligamt.Text ds.Tables("emp_details").Rows(n).Item(6) = txtfno.Text ds.Tables("emp_details").Rows(n).Item(7) = txtyear.Text da.Update(ds.Tables("emp_details")) But Iam getting the error as : "Update requires a valid updatecommand when passed Datarow collection with modified rows". Please suggest me correct code for this updation urgently ThanX in advance

    S D 2 Replies Last reply
    0
    • V venkata lakshmi prasanna

      Iam new to VB.Net2005. In the Form Load Event Iam Displaying Data into Datagridviewand I have written a code for Double-click event which is going to disply the data in the relevent textboxes from datagridview. After Displaying I want to modify the Data and updating it into the Database. For this I have written the code as: ds.Tables("emp_details").Rows(n).Item(1) = txtsurname.Text ds.Tables("emp_details").Rows(n).Item(2) = txtname.Text ds.Tables("emp_details").Rows(n).Item(3) = txtdesg.Text ds.Tables("emp_details").Rows(n).Item(4) = txtplace.Text ds.Tables("emp_details").Rows(n).Item(5) = txteligamt.Text ds.Tables("emp_details").Rows(n).Item(6) = txtfno.Text ds.Tables("emp_details").Rows(n).Item(7) = txtyear.Text da.Update(ds.Tables("emp_details")) But Iam getting the error as : "Update requires a valid updatecommand when passed Datarow collection with modified rows". Please suggest me correct code for this updation urgently ThanX in advance

      S Offline
      S Offline
      Sonia Gupta
      wrote on last edited by
      #2

      What is da.Update?

      V 1 Reply Last reply
      0
      • S Sonia Gupta

        What is da.Update?

        V Offline
        V Offline
        venkata lakshmi prasanna
        wrote on last edited by
        #3

        That is DataAdapter.Update

        S 1 Reply Last reply
        0
        • V venkata lakshmi prasanna

          That is DataAdapter.Update

          S Offline
          S Offline
          Sonia Gupta
          wrote on last edited by
          #4

          I tried this link at Google.

          1 Reply Last reply
          0
          • V venkata lakshmi prasanna

            Iam new to VB.Net2005. In the Form Load Event Iam Displaying Data into Datagridviewand I have written a code for Double-click event which is going to disply the data in the relevent textboxes from datagridview. After Displaying I want to modify the Data and updating it into the Database. For this I have written the code as: ds.Tables("emp_details").Rows(n).Item(1) = txtsurname.Text ds.Tables("emp_details").Rows(n).Item(2) = txtname.Text ds.Tables("emp_details").Rows(n).Item(3) = txtdesg.Text ds.Tables("emp_details").Rows(n).Item(4) = txtplace.Text ds.Tables("emp_details").Rows(n).Item(5) = txteligamt.Text ds.Tables("emp_details").Rows(n).Item(6) = txtfno.Text ds.Tables("emp_details").Rows(n).Item(7) = txtyear.Text da.Update(ds.Tables("emp_details")) But Iam getting the error as : "Update requires a valid updatecommand when passed Datarow collection with modified rows". Please suggest me correct code for this updation urgently ThanX in advance

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            You're looking for the CommandBuilder class for the database you're using. If you have an Access database, then you'd be using the OleDbCommandBuilder[^]. If SQL Server, SqlCommandBuilder[^]. These classes take the Select command that you gave to your dataadapter and build the other three corresponding SQL commands, DELETE, INSERT, and UPDATE, for you. It will only work with single table Select commands though.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            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