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

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.
LVL 1
BeamsonAsked:
Who is Participating?
 
peh803Connect With a Mentor Commented:
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
 
peh803Commented:
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
 
BeamsonAuthor Commented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
peh803Commented:
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
 
peh803Commented:
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
 
BeamsonAuthor Commented:
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
 
BeamsonAuthor Commented:
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
 
peh803Commented:
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
 
BeamsonAuthor Commented:
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
 
peh803Commented:
@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
All Courses

From novice to tech pro — start learning today.