Results 1 to 10 of 10

Thread: Dataset/Table question

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Dataset/Table question

    I have a dataset which has 1 table with 10 coloumns and n rows.

    I create a new table "newTable" which contains 2 coloumns "A" and "B".

    I want to copy the contents of col 7 and col 8 of the original dataset/table into "newTable".

    Whats the most efficient way of doing this ?

    Coming up with a refined way of doing this is important as I perform this operation often in my application.

    Parksie

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    Try something like this
    Code:
    Dim NewTable As DataTable
    Dim dsCopy As DataSet
    
    dsCopy = OriginalDataSet.Copy
    
    NewTable = dsCopy.Tables.Add("NewTableName")
    
    With NewTable
      .Columns.Add("Field7", GetType(String))
      .Columns.Add("Field8", GetType(String))
    End With
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    Do I have to create a new dataset ?

    Can I not just create a new table and copy the details from the old table to the new ?

    Parksie

  4. #4
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    yes.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    OriginalDataSet.Tables.Add("JimiHendrix")


  6. #6
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    Is Parksie really dead? I just read the thread in the C\C++ forum... I never really knew him but if he is dead that sucks. He seemed like a good guy.
    Magiaus

    If I helped give me some points.

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Yes, I see how that would figure into datasets.

  8. #8
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    so your a mod now frog man? I was just wondering since you guys are all sporting the 1983 - 2004....
    Magiaus

    If I helped give me some points.

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by Magiaus
    so your a mod now frog man? I was just wondering since you guys are all sporting the 1983 - 2004....
    Nah, I don't earn enough money to become a mod here.

  10. #10
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    yeah no kidding
    Magiaus

    If I helped give me some points.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width