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. db commant not working

db commant not working

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

    hi :) i have this commend to update but it did not work can any body Expected way it did not work Dim Slots5Sec As New DataSet Dim DataAdapter6 As New OleDb.OleDbDataAdapter(SqlSlots4Sec, con) Dim CmdB1 As New OleDb.OleDbCommandBuilder(DataAdapter6) DataAdapter6.Fill(Slots5Sec, "Slot") ' fill the data set DataAdapter6.Update(Slots5Sec, "Slot") i change in some value and i want to save it in db ?

    D 1 Reply Last reply
    0
    • A asha_s

      hi :) i have this commend to update but it did not work can any body Expected way it did not work Dim Slots5Sec As New DataSet Dim DataAdapter6 As New OleDb.OleDbDataAdapter(SqlSlots4Sec, con) Dim CmdB1 As New OleDb.OleDbCommandBuilder(DataAdapter6) DataAdapter6.Fill(Slots5Sec, "Slot") ' fill the data set DataAdapter6.Update(Slots5Sec, "Slot") i change in some value and i want to save it in db ?

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

      That code you posted is incomplete, so you may not get an accurate answer...

      asha_s wrote:

      DataAdapter6.Fill(Slots5Sec, "Slot") ' fill the data set DataAdapter6.Update(Slots5Sec, "Slot")

      But, you didn't make any changes to the dataset between the Fill statement (which, I'm assuming, retrieved a bunch of records from the database) and the Update statement (which writes changes back to the database.) UPDATE: I notice your messages down the forum. If you're trying to use an SQL statement that retrieves data from multiple tables, like using a JOIN, the SqlCommandBuilder will not generate UPDATE, DELETE, and INSERT commands for the DataAdapter. The DataAdapters only work with single table queries when performing updates. SELECT queries on multiple tables work just fine though.

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

      A 1 Reply Last reply
      0
      • D Dave Kreskowiak

        That code you posted is incomplete, so you may not get an accurate answer...

        asha_s wrote:

        DataAdapter6.Fill(Slots5Sec, "Slot") ' fill the data set DataAdapter6.Update(Slots5Sec, "Slot")

        But, you didn't make any changes to the dataset between the Fill statement (which, I'm assuming, retrieved a bunch of records from the database) and the Update statement (which writes changes back to the database.) UPDATE: I notice your messages down the forum. If you're trying to use an SQL statement that retrieves data from multiple tables, like using a JOIN, the SqlCommandBuilder will not generate UPDATE, DELETE, and INSERT commands for the DataAdapter. The DataAdapters only work with single table queries when performing updates. SELECT queries on multiple tables work just fine though.

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

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

        thanks :-D :-D i found the error

        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