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. Accessing datatable without interface. [modified]

Accessing datatable without interface. [modified]

Scheduled Pinned Locked Moved C#
tutorialquestion
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.
  • P Offline
    P Offline
    PyroManiak
    wrote on last edited by
    #1

    I've done a tbAdapter.fill(DataSet.datatable); How do I edit the datatable through code? I need to be able to add new rows to the table and I'm having trouble figuring out how. Anyone have a guide that demonstrates this though code? (IE, no interface for background processes). -- modified at 19:59 Thursday 29th June, 2006 I dont understand how to use dataSet.DataTable.addTableRow() if anyone cares to explain this to me (if it is what I'm even looking for). Thanks again.

    S 1 Reply Last reply
    0
    • P PyroManiak

      I've done a tbAdapter.fill(DataSet.datatable); How do I edit the datatable through code? I need to be able to add new rows to the table and I'm having trouble figuring out how. Anyone have a guide that demonstrates this though code? (IE, no interface for background processes). -- modified at 19:59 Thursday 29th June, 2006 I dont understand how to use dataSet.DataTable.addTableRow() if anyone cares to explain this to me (if it is what I'm even looking for). Thanks again.

      S Offline
      S Offline
      Sean89
      wrote on last edited by
      #2

      Adding a row to the table is really quite simple. You are looking for datatable.NewRow(); To add a new row you would do something like this:

      DataRow newrow = datatable.NewRow(); // Create a new row

      row[0] = "blah blah blah";
      row[2] = ...
      // add some more data to the row
      ...

      dataTable.Rows.Add(newrow); //add the row to the table

      Basically it creates a new row based on the columns that you have in the already constructed table. You can also set values for different columns in the row like:

      row["SomeColumn"] = "blah blah blah";

      Thats really all there is to it :laugh: Hope that helps.


      P 1 Reply Last reply
      0
      • S Sean89

        Adding a row to the table is really quite simple. You are looking for datatable.NewRow(); To add a new row you would do something like this:

        DataRow newrow = datatable.NewRow(); // Create a new row

        row[0] = "blah blah blah";
        row[2] = ...
        // add some more data to the row
        ...

        dataTable.Rows.Add(newrow); //add the row to the table

        Basically it creates a new row based on the columns that you have in the already constructed table. You can also set values for different columns in the row like:

        row["SomeColumn"] = "blah blah blah";

        Thats really all there is to it :laugh: Hope that helps.


        P Offline
        P Offline
        PyroManiak
        wrote on last edited by
        #3

        Thanks! worked like a charm...

        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