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. changing a table name in dataset

changing a table name in dataset

Scheduled Pinned Locked Moved C#
question
4 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.
  • R Offline
    R Offline
    Ramkithepower
    wrote on last edited by
    #1

    Hi , Is there a way to change the table name of a datatable in a dataset or create a new dataset and copy the table with a new name in to the new dataset?

    Jack Sparrow -------------------------------------- Defeat is not the worst of failures. Not to have tried is the true failure.

    S 1 Reply Last reply
    0
    • R Ramkithepower

      Hi , Is there a way to change the table name of a datatable in a dataset or create a new dataset and copy the table with a new name in to the new dataset?

      Jack Sparrow -------------------------------------- Defeat is not the worst of failures. Not to have tried is the true failure.

      S Offline
      S Offline
      Sandesh M Patil
      wrote on last edited by
      #2

      Use below code and next time try to use Google

      dataset.Tables[0].TableName = "MyTable1";
      dataset.Tables[1].TableName = "MyTable2";

      or do it in loop

      for (int i = 0; i <= dataset.Tables.Count; i++)
      {

      dataset.Tables[i].TableName = "MyTable" + i.ToString();
      }

      Cheers,
      SMP

      Recent Tip/Tricks
      Prevent a drag and drop text and Copy paste text in your textbox control
      Find a column name within SQL database

      R 1 Reply Last reply
      0
      • S Sandesh M Patil

        Use below code and next time try to use Google

        dataset.Tables[0].TableName = "MyTable1";
        dataset.Tables[1].TableName = "MyTable2";

        or do it in loop

        for (int i = 0; i <= dataset.Tables.Count; i++)
        {

        dataset.Tables[i].TableName = "MyTable" + i.ToString();
        }

        Cheers,
        SMP

        Recent Tip/Tricks
        Prevent a drag and drop text and Copy paste text in your textbox control
        Find a column name within SQL database

        R Offline
        R Offline
        Ramkithepower
        wrote on last edited by
        #3

        Thanks mate, really not sure how I missed this...

        Jack Sparrow -------------------------------------- Defeat is not the worst of failures. Not to have tried is the true failure.

        S 1 Reply Last reply
        0
        • R Ramkithepower

          Thanks mate, really not sure how I missed this...

          Jack Sparrow -------------------------------------- Defeat is not the worst of failures. Not to have tried is the true failure.

          S Offline
          S Offline
          Sandesh M Patil
          wrote on last edited by
          #4

          you are welcome :)

          Cheers,
          SMP

          Recent Tip/Tricks
          Prevent a drag and drop text and Copy paste text in your textbox control
          Find a column name within SQL database

          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