Results 1 to 3 of 3

Thread: [2005] Inserting Datatable straight into Access Database

  1. #1

    Thread Starter
    Frenzied Member dinosaur_uk's Avatar
    Join Date
    Sep 2004
    Location
    Jurassic Park
    Posts
    1,098

    [2005] Inserting Datatable straight into Access Database

    Hi All!

    Hope you all are well.

    I am basically storing all my user input into a datatable, and when the user finishes, i want to send that datatable into an Access Database.

    Is there a quick way of doing it instead of opening a connection, using the insert command (with parameters) on each row, and looping to the end.

    Can i map my datatable columns to the database columns.

    Cheers
    If you find my thread helpful, please remember to rate me

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: [2005] Inserting Datatable straight into Access Database

    Quote Originally Posted by dinosaur_uk
    Hi All!

    Hope you all are well.

    I am basically storing all my user input into a datatable, and when the user finishes, i want to send that datatable into an Access Database.

    Is there a quick way of doing it instead of opening a connection, using the insert command (with parameters) on each row, and looping to the end.

    Can i map my datatable columns to the database columns.

    Cheers
    I really believe though that looping through is the best way, its gives you allot more flexibility, plus you have the option to implement custom filters data check etc.

    Pino

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Inserting Datatable straight into Access Database

    There's no magic. You need to create a Connection, create a DataAdapter, create its InsertCommand, call its Update method and pass the DataTable.

    If you create a Data Source in your project then the TableAdapter will be generated that does the first three steps for you, so all you need to do is call Update and pass the DataTable.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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