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. Visual Basic
  4. Update db in ADO.NET

Update db in ADO.NET

Scheduled Pinned Locked Moved Visual Basic
databasecsharphtmlcsscom
7 Posts 4 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.
  • T Offline
    T Offline
    TheMrProgrammer
    wrote on last edited by
    #1

    I have a database in which I put data by using ADO. The database is .mdb When i run the sub which puts the data in the database everything goes fine. I add about 30k rows. But when i run the same sub again,ie when i update the database, it tries to put the data, but in that data some old data is also present and there comes a msgbox saying that duplicate entries and much more. How to avoid this? one more Q: the size of the mdb file reaches to 50MB. is there a way to have the size less?

    TheMrProgrammer http://www.icbse.com/2009/funny-exam-answers-school-students http://download.cnet.com/TheCalcMan/3000-2094\_4-10958266.html

    H K S 3 Replies Last reply
    0
    • T TheMrProgrammer

      I have a database in which I put data by using ADO. The database is .mdb When i run the sub which puts the data in the database everything goes fine. I add about 30k rows. But when i run the same sub again,ie when i update the database, it tries to put the data, but in that data some old data is also present and there comes a msgbox saying that duplicate entries and much more. How to avoid this? one more Q: the size of the mdb file reaches to 50MB. is there a way to have the size less?

      TheMrProgrammer http://www.icbse.com/2009/funny-exam-answers-school-students http://download.cnet.com/TheCalcMan/3000-2094\_4-10958266.html

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      TheMrProgrammer wrote:

      But when i run the same sub again,ie when i update the database, it tries to put the data, but in that data some old data is also present and there comes a msgbox saying that duplicate entries and much more.

      Without seeing the relevant parts of your code, any one who attempts an answer is simply guessing.

      TheMrProgrammer wrote:

      one more Q: the size of the mdb file reaches to 50MB. is there a way to have the size less?

      Again without knowing more about the Database it is almost impossible to tender a cogent reply.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      1 Reply Last reply
      0
      • T TheMrProgrammer

        I have a database in which I put data by using ADO. The database is .mdb When i run the sub which puts the data in the database everything goes fine. I add about 30k rows. But when i run the same sub again,ie when i update the database, it tries to put the data, but in that data some old data is also present and there comes a msgbox saying that duplicate entries and much more. How to avoid this? one more Q: the size of the mdb file reaches to 50MB. is there a way to have the size less?

        TheMrProgrammer http://www.icbse.com/2009/funny-exam-answers-school-students http://download.cnet.com/TheCalcMan/3000-2094\_4-10958266.html

        K Offline
        K Offline
        Kschuler
        wrote on last edited by
        #3

        We're going to need more information to help you. How are you adding these records. What error messages are you getting? Are you using a DataAdapter or just straight insert commands? Are your tables constrained to be unique? Also,

        TheMrProgrammer wrote:

        one more Q: the size of the mdb file reaches to 50MB. is there a way to have the size less?

        Access database files will retain their size even after records have been deleted. (If you had a .mdb file with thousands of records, then deleted the records, the .mdb file will still be very large in size.) If this is what you are referring to, Yes. You can reclaim what is no longer being used by the file. I think I used one of these articles[^] when I needed to accomplish this goal. Hope this helps.

        T 1 Reply Last reply
        0
        • T TheMrProgrammer

          I have a database in which I put data by using ADO. The database is .mdb When i run the sub which puts the data in the database everything goes fine. I add about 30k rows. But when i run the same sub again,ie when i update the database, it tries to put the data, but in that data some old data is also present and there comes a msgbox saying that duplicate entries and much more. How to avoid this? one more Q: the size of the mdb file reaches to 50MB. is there a way to have the size less?

          TheMrProgrammer http://www.icbse.com/2009/funny-exam-answers-school-students http://download.cnet.com/TheCalcMan/3000-2094\_4-10958266.html

          S Offline
          S Offline
          Steven J Jowett
          wrote on last edited by
          #4

          I suspect that you are not clearing or reinitialising the variables holding the data after the data is added to your database, therefore some of the data would be written to the database again, on subsequent writes to the database.

          Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

          T 1 Reply Last reply
          0
          • S Steven J Jowett

            I suspect that you are not clearing or reinitialising the variables holding the data after the data is added to your database, therefore some of the data would be written to the database again, on subsequent writes to the database.

            Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

            T Offline
            T Offline
            TheMrProgrammer
            wrote on last edited by
            #5

            No No This was not the case. thanks anyway for trying to help.

            TheMrProgrammer http://www.icbse.com/2009/funny-exam-answers-school-students http://download.cnet.com/TheCalcMan/3000-2094\_4-10958266.html

            1 Reply Last reply
            0
            • K Kschuler

              We're going to need more information to help you. How are you adding these records. What error messages are you getting? Are you using a DataAdapter or just straight insert commands? Are your tables constrained to be unique? Also,

              TheMrProgrammer wrote:

              one more Q: the size of the mdb file reaches to 50MB. is there a way to have the size less?

              Access database files will retain their size even after records have been deleted. (If you had a .mdb file with thousands of records, then deleted the records, the .mdb file will still be very large in size.) If this is what you are referring to, Yes. You can reclaim what is no longer being used by the file. I think I used one of these articles[^] when I needed to accomplish this goal. Hope this helps.

              T Offline
              T Offline
              TheMrProgrammer
              wrote on last edited by
              #6

              well.... partially you were correct to guess. what you suggested was not the Q i asked. But I am glad for the links of these articles. Thanks. My initial problem is solved. It was a case of index. Let me explain my 2nd Q. Suppose i have new database D. In it i write about 20 MB of data. so the size of D is 20 MB. What I wish is compress D so the 20MB reduces to a less value. Is it possible?

              TheMrProgrammer http://www.icbse.com/2009/funny-exam-answers-school-students http://download.cnet.com/TheCalcMan/3000-2094\_4-10958266.html

              K 1 Reply Last reply
              0
              • T TheMrProgrammer

                well.... partially you were correct to guess. what you suggested was not the Q i asked. But I am glad for the links of these articles. Thanks. My initial problem is solved. It was a case of index. Let me explain my 2nd Q. Suppose i have new database D. In it i write about 20 MB of data. so the size of D is 20 MB. What I wish is compress D so the 20MB reduces to a less value. Is it possible?

                TheMrProgrammer http://www.icbse.com/2009/funny-exam-answers-school-students http://download.cnet.com/TheCalcMan/3000-2094\_4-10958266.html

                K Offline
                K Offline
                Kschuler
                wrote on last edited by
                #7

                You can create a zip file. Here are some articles[^] about how to do that in code. But I'm not sure this is exactly what you are looking for either. In order to use a zipped file you'd have to convert it back to the file type it was before, which would increase it back to it's original size as well. But if you are looking to compress it as a means of archiving or backing up this may work for you. Good luck!

                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