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. Cloning Data Tables

Cloning Data Tables

Scheduled Pinned Locked Moved C#
game-devquestion
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
    afronaut
    wrote on last edited by
    #1

    Is there an easy way to clone a DataTable? *->>Always working on my game, teach me *->>something new. cout << "dav1d\n";

    E 1 Reply Last reply
    0
    • A afronaut

      Is there an easy way to clone a DataTable? *->>Always working on my game, teach me *->>something new. cout << "dav1d\n";

      E Offline
      E Offline
      Ernesto Perales Soto
      wrote on last edited by
      #2

      DataRow[] sourceRows=sourceTable.Select(); DataTable targetTable=sourceTable.Clone(); foreach(DataRow sourceRow in sourceRows) targetTable.ImportRow(sourceRow); :) eperales

      A 1 Reply Last reply
      0
      • E Ernesto Perales Soto

        DataRow[] sourceRows=sourceTable.Select(); DataTable targetTable=sourceTable.Clone(); foreach(DataRow sourceRow in sourceRows) targetTable.ImportRow(sourceRow); :) eperales

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

        what is s1ck about that is that I just clone the table without its rows; all I need is the schema. Thanks E. *->>Always working on my game, teach me *->>something new. cout << "dav1d\n";

        A 1 Reply Last reply
        0
        • A afronaut

          what is s1ck about that is that I just clone the table without its rows; all I need is the schema. Thanks E. *->>Always working on my game, teach me *->>something new. cout << "dav1d\n";

          A Offline
          A Offline
          Arjan Einbu
          wrote on last edited by
          #4

          DataSet ds; ds.Clone(); From MSDN: DataSet.Clone Method Copies the structure of the DataSet, including all DataTable schemas, relations, and constraints. Does not copy any data. [C#] [Serializable] public virtual DataSet Clone(); Return Value A new DataSet with the same schema as the current DataSet, but none of the data.

          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