Update db in ADO.NET
-
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
-
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
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.”
-
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
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.
-
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
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.
-
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.
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
-
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.
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
-
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
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!