Results 1 to 5 of 5

Thread: How to copy a datarow from one table to another?

  1. #1
    Join Date
    Jan 2009
    Posts
    10

    How to copy a datarow from one table to another?

    Hi,
    I want to copy datarow from one table & then insert into another table, but i am having some problems with this.

    I don't know what is the correct way to do this? I tried the import row method but it gives an exception.

    Thanks for the help.

  2. #2
    Join Date
    Jun 2008
    Posts
    144

    Re: How to copy a datarow from one table to another?

    Hey you can do this by using the ItemArray property, and then attaching the new row to the destination table via InsertAt.

    I hope this helps you!

  3. #3
    Join Date
    Jan 2009
    Posts
    10

    Re: How to copy a datarow from one table to another?

    Thanks Ettan!
    I tried using ItemArray property but it gives me an the datarow at the last record but not on the position where i want it to be shown.
    What could be the problem?

  4. #4
    Join Date
    Jun 2008
    Posts
    144

    Re: How to copy a datarow from one table to another?

    Hi,
    Why don't you use dataview with properties set instead of datagrid?
    I think this will solve your problem.

  5. #5
    Join Date
    Jul 2009
    Posts
    1

    Re: How to copy a datarow from one table to another?

    HI, you can try the follow to copy a datarow to anothher table:

    First, copy the schema of the table you want to copy, to the new table

    dim newTable as new dataTable
    newtable=originalTable.Clone

    after that, using ImportRow you can copy the rows you want
    For n As Integer = 0 To originalTable.Rows.Count - 1

    newtable.ImportRow(originalTable.Rows(n))

    Next

    hope it helps you!! it's the best way

Similar Threads

  1. How to copy a pivot table into a 2 dimensional table ?
    By Udyami in forum Windows Software
    Replies: 4
    Last Post: 27-11-2010, 11:35 PM
  2. SQL Query For Copy records from one table to another
    By Bellamy in forum Software Development
    Replies: 4
    Last Post: 23-05-2010, 12:36 AM
  3. Copy field in same table
    By Miles Runner in forum Software Development
    Replies: 4
    Last Post: 17-02-2010, 02:13 AM
  4. How to copy one table data into another table directly?
    By ComPaCt in forum Software Development
    Replies: 3
    Last Post: 22-09-2009, 03:54 PM
  5. Is there any way i can copy a Word table into Excel
    By Apple.Mac.Rocker in forum Windows Software
    Replies: 3
    Last Post: 29-08-2009, 08:08 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,551,809.90245 seconds with 17 queries