Results 1 to 2 of 2

Thread: Easy way to export datatable to Access?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    Connecticut
    Posts
    257

    Easy way to export datatable to Access?

    I am using VS 2010 and Access 2010. I need to export a table from a windows form into access database. The table does not exist yet in the Access DB. Is there an easy way to do this rather than doing a create table command followed by looping through the data inserting row by row? Seems like there should be an easier way, but I may be wrong. Thanks in advance.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Easy way to export datatable to Access?

    You do need to execute a CREATE TABLE statement but inserting the data doesn't require a loop. You can just use a data adapter and call its Update method to save all your changes in a batch, as always. That requires that all the DataRows in your DataTable have a RowState of Added. If you've added the rows to the table manually then that should already be the case. If the DataTable was populated by calling Fill on a data adapter then make sure that that adapter's AcceptChangesOnFill property is set to False.

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