Solved

Copy table as needed over the internet

Posted on 2011-09-15
6
476 Views
Last Modified: 2012-05-12
Hi experts,

I have an application that some users are running on the field. The application is a quote application. What I would like to acomplish is that when the application starts, it could check a table over the internet and if this table is newer that the one in the laptop it will replace it. The table is small table, it can even compressed and have it as a zip file.

Thanks,

0
Comment
Question by:falvarad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:wcsoctu
ID: 36545424
* in my opening prg (http://www.west-wind.com/wwipstuff.zip)
SET PROCEDURE TO wwUtils.prg
SET CLASSLIB TO wwIPStuff


* my internet function
FUNCTION Internet
DECLARE SHORT InternetGetConnectedState IN wininet.Dll;
   INTEGER @lpdwFlags, INTEGER dwReserved
LOCAL lConnected
lConnected = .F.
lpdwFlags = 0
IF InternetGetConnectedState (@lpdwFlags, 0) = 1
   MyFTP=CREATE('wwFTP')
   ConnectResult=MyFTP.FTPConnect('myftpsite',"myftpuser","myftppassword")
   FTPFound=(ConnectResult=0)
   lConnected = .T.
ENDIF
RETURN lConnected


* my code to check for update

IF Internet()
   * get remote file details, if not there no need to go further
   RemoteFileFound=.F.
   DIMENSION RemoteArray(1,4)
   ADIRResult=MyFTP.aFTPDIR(@RemoteArray,"ftpfolder/ftpfile.dbf")
   IF ADIRResult>0
      RemoteFileFound=.T.
      RemoteFileSize=RemoteArray(1,2)
      RemoteFileDate=TTOD(RemoteArray(1,4))
   ENDIF

   IF RemoteFileFound
      UpdateTheFile=.F.
      CompareCount=ADIR(LocalArray,'c:\localfolder\localfile.dbf')
      IF CompareCount=1
         LocalFileSize=LocalArray(1,2)
         LocalFileDate=LocalArray(1,3)
         IF RemoteFileSize<>LocalFileSize OR RemoteFileDate>LocalFileDate
            UpdateTheFile=.T.
         ENDIF
   ELSE
      UpdateTheFile=.T.
   ENDIF
   IF UpdateTheFile
      MyFTP.FTPGetFileEx("ftpfolder/ftpfile.dbf","c:\localfolder\localfile.dbf")
   ENDIF
ENDIF
0
 

Author Comment

by:falvarad
ID: 36545548
It looks good but the zip file is not there.

Thanks
0
 
LVL 4

Expert Comment

by:wcsoctu
ID: 36545566
localfile.dbf was just an example.  Use any folder/filenames you want.
0
Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

 

Author Comment

by:falvarad
ID: 36545659
I'm sorry I'm talking about the zip file that contain wwUtIPStuff and wwUtils.prg
SET PROCEDURE TO wwUtils.prg
SET CLASSLIB TO wwIPStuff
0
 
LVL 4

Accepted Solution

by:
wcsoctu earned 500 total points
ID: 36545683
0
 

Author Closing Comment

by:falvarad
ID: 36545707
Thank you, i will test this but it seems exactly what I need.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

617 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