Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Copy table as needed over the internet

Posted on 2011-09-15
6
Medium Priority
?
481 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
  • 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
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 

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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

972 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