Solved

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

Posted on 2006-06-30
11
282 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

16 Experts available now in Live!

Get 1:1 Help Now