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. Visual Basic
  4. Should I have to explicity create a dataset even it is already defined in design time?

Should I have to explicity create a dataset even it is already defined in design time?

Scheduled Pinned Locked Moved Visual Basic
csharpdesignquestion
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.
  • J Offline
    J Offline
    JUNEYT
    wrote on last edited by
    #1

    Hello, I am working with a dataset and I just realized that there is a few methods in vb.net to add a new row to a dataset. Can I simply add a row in figure 1 instead of creating an explicit dataset and a data table because in design time I created a dataset already. Why do I have to explicitly create a dataset and a table and then a row if I am able to add a new row with new values with a single line code? Thanks.

    Figure 1. // I have assumed 3 columns in the NameTable

     BPRO.NameTable.Rows.Add("Jashua", "Carla", "Chris")
    

    THE USUAL WAY WAS

    Figure 2.

        Dim NewDS As New BPRO
        Dim Rt As New BPRO.NameTable
        Dim NewRow As DataRow = NewDS.Tables("NameTable").NewRow
    
        NewRow("Names") = Trim(UserName.Text.ToUpper)
        NewDS.Tables("NameTable").Rows.Add(NewRow)
    

    What a curious mind needs to discover knowledge is noting else than a pin-hole.

    T 1 Reply Last reply
    0
    • J JUNEYT

      Hello, I am working with a dataset and I just realized that there is a few methods in vb.net to add a new row to a dataset. Can I simply add a row in figure 1 instead of creating an explicit dataset and a data table because in design time I created a dataset already. Why do I have to explicitly create a dataset and a table and then a row if I am able to add a new row with new values with a single line code? Thanks.

      Figure 1. // I have assumed 3 columns in the NameTable

       BPRO.NameTable.Rows.Add("Jashua", "Carla", "Chris")
      

      THE USUAL WAY WAS

      Figure 2.

          Dim NewDS As New BPRO
          Dim Rt As New BPRO.NameTable
          Dim NewRow As DataRow = NewDS.Tables("NameTable").NewRow
      
          NewRow("Names") = Trim(UserName.Text.ToUpper)
          NewDS.Tables("NameTable").Rows.Add(NewRow)
      

      What a curious mind needs to discover knowledge is noting else than a pin-hole.

      T Offline
      T Offline
      T2102
      wrote on last edited by
      #2

      As far as I know, it should work. I have used ADO in C++.

      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