Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update online database 1

Status
Not open for further replies.

SuperComputing

IS-IT--Management
Oct 11, 2007
57
US
I have a local server that contains our inventory that changes constantly. Our online store is hosted elsewhere and uses a mysql database for storing the inventory. I would like to update the online database every hour.

I have a local SQL script that pulls the local updated inventory data (2100 rows) in under a second.

If I log in to the PHP admin and import the data from csv, it takes about a second.

If I try to make an asp page pull the local data and write it to the online database, whether updating existing records or inserting new rows into a blank database, it can take up to 30 mins.

Any ideas?

Here's some of my code (for when I have a blank database):

Code:
Set RemoteConn = Server.CreateObject("ADODB.Connection")
RemoteConnStr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword
RemoteConn.Open RemoteConnStr
Set LocalConn = Server.CreateObject("ADODB.Connection")
LocalConn.open = "DSN=CPDATA;"

LocalQry = "SELECT Items.ItemNumber, Items.Description1, Items.Price, Inventory.QtyOnHand AS Qty etc...
FROM Items 
LEFT JOIN Inventory ON Items.ItemNumber = Inventory.ItemNumber 
WHERE ... 
Set LocalRS = LocalConn.Execute(LocalQry)

do until LocalRS.EOF 
ItemNumber = LocalRS("ItemNumber")
Description1 = LocalRS("Description1")
etc...

AddItem = "INSERT INTO " & tablename & " VALUES ( '"&Replace(ItemNumber,"'","''")&"','"&Replace(Description1,"'","''")&"',etc...
RemoteConn.Execute(AddItem)

LocalRS.MoveNext
loop


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top