Solved

Synchronising/overwriting an MS Access table on a live site with one from a local filestore.

Posted on 2006-06-30
11
281 Views
Last Modified: 2008-03-03
I have a live website which uses an MS Access database to hold data and uses ASP to interrogate it.
Several tables in the database relate to stock items and cross-referencing to them.
Several other tables relate to user orders.

I want to be able to update the stock item and cross-reference tables on the site whilst keeping the site live and leaving the database accessible.  What is the best way of doing this?

At the moment, I do this very awkwardly by downloading a copy of the site database from the site to my PC ( with the latest set of order information in it ), overwriting the relevant product tables, then quickly uploading it back to the site before someone else places an order on it.  If someone attempts to place an order while I am doing this, there is the risk that my upload of the database will overwrite the order, leaving no record.
0
Comment
Question by:Beamson
  • 6
  • 4
11 Comments
 
LVL 19

Expert Comment

by:peh803
ID: 17018258
Okay -- so you basically want to be able to update a product list (and potentially quantity / inventory figures) with new data, as it becomes available?

How is this new product and inventory data delivered to you (*.dat file, excel, another DB, etc.)?  What data structure do you want it to go in?  Since you're doing this today successfully, I'm not trying to redesign the process -- just trying to understand better what your situation is.

Thanks,
Phil
0
 
LVL 1

Author Comment

by:Beamson
ID: 17018528
Hi Phil,

Periodically (every few days), I am passed an MS Access file from one of my colleagues, containing only up-to-date stock and cross-reference tables.  The structure of the data within the tables is lengthy but to give a sample representation, see the table structures below:

tbl_cross_ref
---------------
record_id
brand
model
our_part

tbl_stock
----------
stock_code
availability
price

The database behind our website (externally hosted) contains identical tables to these (with potentially stale data) plus tables relating to orders which are placed on the site.
0
 
LVL 19

Expert Comment

by:peh803
ID: 17018573
Okay -- and so what you want to do is be able to drop the contents of the existing database and replace all contents with the contents of this newly updated database that is provided by a business partner of yours?

If that's the goal, it should be certainly feasable to set up a process that can do this on the remote server...

Let me know if I understand correctly.

Thanks,
Phil
0
 
LVL 19

Expert Comment

by:peh803
ID: 17018577
Also, how many columns (approximately) are in the largest table, and how many rows on average?  I just want to get an idea of how much data we're talking about having to import and export.

Thanks,
Phil
0
 
LVL 1

Author Comment

by:Beamson
ID: 17018666
The largest table is the cross-reference table.
Currently, this has 10,000 rows and 10 columns
Over the forseeable lifetime of this project, the number of rows should increase to something like 50,000.

I think your understanding is of the requirement is half-correct - I do want to drop SOME of the tables in the database and replace them (i.e the cross-reference and stock tables).  However, I need to keep the live orders tables intact and unaffected.  Does this make sense?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 19

Accepted Solution

by:
peh803 earned 250 total points
ID: 17019405
Beamson -- this does make sense to me.

I would recommend that you write a script that will connect to both databases and copy the table from the new database, "databaseNew.mdb", into the existing database, "databaseExisting.mdb".  The best method will probably be to copy all the new records into a temporary table, and then compare the existing records to the new records and update any that may have changed.  I doubt all 50,000 will have changed every time, and updating / inserting only the small percentage of the ones that have changed each time will significantly help, performance wise.

Does this sound like it will solve your issue?  I can, of course, help you with the design of this process.  Just want to make sure it makes sense thus far.

Regards,
Phil
0
 
LVL 1

Author Comment

by:Beamson
ID: 17029800
Hi Phil,

I think this sounds like it will get the right result - just seems like a lot of steps to have to take to get the desired results.

So would it involve something like:

1) Uploading databaseNew.mdb to the site
2) Copying tables from databaseNew.mdb to databaseExisting.mdb (not sure I can do this easily - help would be appeciated!)
3) Running delete, update and append queries between the xxxNew and xxxExisiting tables (messy, but I think I can handle this).
4) Tidy up - delete databaseNew.mdb, all xxxNew tables (could do with help on deleting tables from remote databases using ASP/SQL)
0
 
LVL 19

Expert Comment

by:peh803
ID: 17267679
I am willing to continue to assist the @Beamson if he/she still needs assistance coming up with code to achieve his/her means...

Regards,
peh803 / Phil
0
 
LVL 1

Author Comment

by:Beamson
ID: 17269621
Hi Phil,

Sorry, have been snowed under here and not had time to give this full attention.  I'm going to have a go at following your suggestion (think the queries needed will be cumbersome and numerous but not actually all that difficult in themselves).

Thanks,

  Craig
0
 
LVL 19

Expert Comment

by:peh803
ID: 17274272
@Craig:

Thanks for the grade, but if you still need some assistance with this, let me know!  I'll be happy to continue to help out.

Regards,
Phil / peh803
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now