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. how to add rows in DataRow object and How to Merge it to Dataset Object

how to add rows in DataRow object and How to Merge it to Dataset Object

Scheduled Pinned Locked Moved C#
csharphelptutorial
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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hello All Plz help me I am new to C#.net and i need to Merge the row to Dataset object I am created code as bellow string name = (GridView1.SelectedRow.Cells[1].Text); int id1 = this.getDetails1(name); :rose: DataRow dw // OleDbConnection myconnection = new OleDbConnection(); myconnection = databaseconnection.getconnection(); string str = "select c_TaxShortName ,c_ItemTaxSchemeDetId from t_Item_Tax_SchemeDetail where (c_ItemTaxSchemeDetIdForFrom= " + id1 + ") and (c_SoftDelete = '1') "; OleDbDataAdapter adpt = new OleDbDataAdapter(str, myconnection); ds = new DataSet(); adpt.Fill(ds); // fill OleDbDataAdapter Object with selected record :rose: ds.Merge(dw); ddl_FieldDef. DataSource = ds; ddl_FieldDef.DataTextField = "c_TaxShortName"; ddl_FieldDef.DataValueField = "c_ItemTaxSchemeDetId"; ddl_FieldDef.DataBind(); // bind data myconnection.Close(); // Close connection I need to add row in DataRow object like ;-> "PP","DP" "MRP"

    D 1 Reply Last reply
    0
    • L Lost User

      Hello All Plz help me I am new to C#.net and i need to Merge the row to Dataset object I am created code as bellow string name = (GridView1.SelectedRow.Cells[1].Text); int id1 = this.getDetails1(name); :rose: DataRow dw // OleDbConnection myconnection = new OleDbConnection(); myconnection = databaseconnection.getconnection(); string str = "select c_TaxShortName ,c_ItemTaxSchemeDetId from t_Item_Tax_SchemeDetail where (c_ItemTaxSchemeDetIdForFrom= " + id1 + ") and (c_SoftDelete = '1') "; OleDbDataAdapter adpt = new OleDbDataAdapter(str, myconnection); ds = new DataSet(); adpt.Fill(ds); // fill OleDbDataAdapter Object with selected record :rose: ds.Merge(dw); ddl_FieldDef. DataSource = ds; ddl_FieldDef.DataTextField = "c_TaxShortName"; ddl_FieldDef.DataValueField = "c_ItemTaxSchemeDetId"; ddl_FieldDef.DataBind(); // bind data myconnection.Close(); // Close connection I need to add row in DataRow object like ;-> "PP","DP" "MRP"

      D Offline
      D Offline
      Drew McGhie
      wrote on last edited by
      #2

      You really can't merge a datarow and a dataset, they're a level of abstraction away from each other. If you're looking to add a row to a table within a dataset, you can use ds.Tables["tablename"].Rows.Add(DataRow), assuming they have the same schema.

      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