none
Send DataTable to MS Access RRS feed

  • Question

  • Hi,

    I am working on an application that takes data from various sources, treats it within a DataTable, and now I need to send that DataTable out to MS Access.

    I see that I can start by generating the CREATE TABLE code (mapping all the field types), and then write loop that does the INSERT command for each DataRow in the DataTable, but it does not seem like a very straightforward solution (especially the mapping of the field types).

    Is there a more straightforward way? I'm working on VS2010 and MS Access 2000.

    Thanks...
    MCHIROUZE
    Wednesday, March 17, 2010 9:11 PM

Answers

  • Unfortunately there is no better solution. You would need to create table in database and insert records one-by-one
    Val Mazur (MVP) http://www.xporttools.net
    • Marked as answer by URBANDIVE Thursday, March 18, 2010 4:36 PM
    Thursday, March 18, 2010 9:51 AM
    Moderator
  • If the data is being inserted in an existing database table with the same structure you may be able to merge it with another DataTable which is using the database table as its source.

    http://www.knowdotnet.com/articles/datasetmerge.html

    Otherwise, as Val stated, it's a row by row process.

    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by URBANDIVE Thursday, March 18, 2010 4:36 PM
    Thursday, March 18, 2010 1:01 PM

All replies

  • Unfortunately there is no better solution. You would need to create table in database and insert records one-by-one
    Val Mazur (MVP) http://www.xporttools.net
    • Marked as answer by URBANDIVE Thursday, March 18, 2010 4:36 PM
    Thursday, March 18, 2010 9:51 AM
    Moderator
  • If the data is being inserted in an existing database table with the same structure you may be able to merge it with another DataTable which is using the database table as its source.

    http://www.knowdotnet.com/articles/datasetmerge.html

    Otherwise, as Val stated, it's a row by row process.

    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by URBANDIVE Thursday, March 18, 2010 4:36 PM
    Thursday, March 18, 2010 1:01 PM