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. C#
  4. Data Base problem

Data Base problem

Scheduled Pinned Locked Moved C#
helptutorialquestionannouncement
4 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
    Ashraj1982
    wrote on last edited by
    #1

    Hi, I'm trying to create a new row and add values to the column in the below code. But it throws exception called "Update unable to find data table 'Table' or Tablemapping 'table' ". DataSet dset = new DataSet(); SqlCommand dbcommand = new SqlCommand(); dbcommand.CommandText ="select * from DBTable"; dbcommand.Connection = myConnection; SqlDataAdapter dbDA = new SqlDataAdapter(dbcommand); dbDA.Fill(dset, "DBTable"); DataTable dbtable = dset.Tables[0]; // dset.Tables.Add(dbtable); DataRow row; row = dbtable.NewRow(); row["Name"] = DBfile; row["Meters"] = IMeter; dbtable.Rows.Add(row); dbDA.Update(dset); any solution? or let me know how to create a new row and assign values to the columns.

    N S 2 Replies Last reply
    0
    • A Ashraj1982

      Hi, I'm trying to create a new row and add values to the column in the below code. But it throws exception called "Update unable to find data table 'Table' or Tablemapping 'table' ". DataSet dset = new DataSet(); SqlCommand dbcommand = new SqlCommand(); dbcommand.CommandText ="select * from DBTable"; dbcommand.Connection = myConnection; SqlDataAdapter dbDA = new SqlDataAdapter(dbcommand); dbDA.Fill(dset, "DBTable"); DataTable dbtable = dset.Tables[0]; // dset.Tables.Add(dbtable); DataRow row; row = dbtable.NewRow(); row["Name"] = DBfile; row["Meters"] = IMeter; dbtable.Rows.Add(row); dbDA.Update(dset); any solution? or let me know how to create a new row and assign values to the columns.

      N Offline
      N Offline
      Naveed Kamboh
      wrote on last edited by
      #2

      It had happend to me some times ago. I used mapping table name as "Table" then it was sorted. when you query then it doesn't understand or pick the table name. it might help you also. Naveed Kamboh

      A 1 Reply Last reply
      0
      • N Naveed Kamboh

        It had happend to me some times ago. I used mapping table name as "Table" then it was sorted. when you query then it doesn't understand or pick the table name. it might help you also. Naveed Kamboh

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

        sorry !! Plz can you tell me in the code where and what i have to change? The problem is i'm new to c# .

        1 Reply Last reply
        0
        • A Ashraj1982

          Hi, I'm trying to create a new row and add values to the column in the below code. But it throws exception called "Update unable to find data table 'Table' or Tablemapping 'table' ". DataSet dset = new DataSet(); SqlCommand dbcommand = new SqlCommand(); dbcommand.CommandText ="select * from DBTable"; dbcommand.Connection = myConnection; SqlDataAdapter dbDA = new SqlDataAdapter(dbcommand); dbDA.Fill(dset, "DBTable"); DataTable dbtable = dset.Tables[0]; // dset.Tables.Add(dbtable); DataRow row; row = dbtable.NewRow(); row["Name"] = DBfile; row["Meters"] = IMeter; dbtable.Rows.Add(row); dbDA.Update(dset); any solution? or let me know how to create a new row and assign values to the columns.

          S Offline
          S Offline
          Saqib Mehmood
          wrote on last edited by
          #4

          check the following article. http://www.codeproject.com/cs/database/sqldawithoutsqlcb.asp hope this would solve the problem. Saqib

          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