Solved

Copy table as needed over the internet

Posted on 2011-09-15
6
435 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Creating and Managing Databases with phpMyAdmin in cPanel.
Read about achieving the basic levels of HRIS security in the workplace.
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…
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…

758 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

17 Experts available now in Live!

Get 1:1 Help Now