Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Copying Data between 2 access databases

Copying Data between 2 access databases

Scheduled Pinned Locked Moved C#
questioncsharpdatabasehelp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hosseinghazanfary
    wrote on last edited by
    #1

    hi dudes, i want to copy a table from an access database to another table on another access database in windows application using c#,what is the best solution,i dont want my application to hang while copying the data,i will be thankful. and how can i make a progress bar and relate it to this copy so it will show how much further is needed to be done.u would solve a big problem of mine by answering me,thank u all.

    C P H 4 Replies Last reply
    0
    • H hosseinghazanfary

      hi dudes, i want to copy a table from an access database to another table on another access database in windows application using c#,what is the best solution,i dont want my application to hang while copying the data,i will be thankful. and how can i make a progress bar and relate it to this copy so it will show how much further is needed to be done.u would solve a big problem of mine by answering me,thank u all.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      1 - you can do it in another thread 2 - you can show a progress bar, but it will mean making lots of smaller copies, which will slow down the process.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      P 1 Reply Last reply
      0
      • C Christian Graus

        1 - you can do it in another thread 2 - you can show a progress bar, but it will mean making lots of smaller copies, which will slow down the process.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        Wouldn't it have to be done row-by-row anyway? When I copy data from one table to another I use a DataReader.

        1 Reply Last reply
        0
        • H hosseinghazanfary

          hi dudes, i want to copy a table from an access database to another table on another access database in windows application using c#,what is the best solution,i dont want my application to hang while copying the data,i will be thankful. and how can i make a progress bar and relate it to this copy so it will show how much further is needed to be done.u would solve a big problem of mine by answering me,thank u all.

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          Does the table exist in the target database or do you need to create it too? Are you doing this in a WinForms application? If so, why? I do such things in Windows Services. 0) Open a connection to the source database 1) Get a count of records to copy 2) Use ExecuteReader to get a DataReader for the records to copy 3) Open a connection to the target database 4) Set up a parameterized insert statement for the target connection 5) while ( reader.Read() ) 5.1) Set the parameter values 5.2) ExecuteNonQuery 5.3) Update the ProgressBar 6) Close the reader, and both connections

          1 Reply Last reply
          0
          • H hosseinghazanfary

            hi dudes, i want to copy a table from an access database to another table on another access database in windows application using c#,what is the best solution,i dont want my application to hang while copying the data,i will be thankful. and how can i make a progress bar and relate it to this copy so it will show how much further is needed to be done.u would solve a big problem of mine by answering me,thank u all.

            H Offline
            H Offline
            hosseinghazanfary
            wrote on last edited by
            #5

            thank u all especialy u pieballconsult for ur solution,the table exists in the destination table,and one more quenstion,when i executereader my select statement for reading from the source table,how can i access each column that is being returned to set it as an parameter for the insert statement?

            1 Reply Last reply
            0
            • H hosseinghazanfary

              hi dudes, i want to copy a table from an access database to another table on another access database in windows application using c#,what is the best solution,i dont want my application to hang while copying the data,i will be thankful. and how can i make a progress bar and relate it to this copy so it will show how much further is needed to be done.u would solve a big problem of mine by answering me,thank u all.

              H Offline
              H Offline
              hosseinghazanfary
              wrote on last edited by
              #6

              dudes i found the ways to access those fields in datareader,so my last question is solved,but iv got a new problem,and that is i have a large amount of records in my database tables,so it would take a very long time for selecting and inserting into destination table row by row.how can i do that by copying the whole table at once,and insert it at once too.i might user dataset and its datatables,but it doesn't work,can anybody give me an example of filling a datatable of a dataset from connection 1,and insert that datatable into connection 2 database? thank u.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups