Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Invalid subscript reference
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01135522
Message ID:
01135862
Views:
14
>Hey buddy ,
> Im curious abt cursors.. Is there a way to reset(or flush) the cursors so that it can be used for a new update. I have different folders, all with "tlog.dbf" tables. I'm trying to import data frm all these tables into one Mysql "tlog" table(basically updating). I ran ur piece of code and it worked fine.But when I tried to update the Mysql tlog table using a different "tlog.dbf" table, it just wrote the same data that was placed previously into cursor crsTest..
>
>
>SELECT PK, tempt FROM tlog;
> into CURSOR crsTest && With all WHERE, GROUP BY if needed
>SQLPREPARE(lccon, [UPDATE mytab SET tdtime=?crsTest.TempT WHERE mytab.PK = ?crsTest.PK])
>SELECT crsTest
>SCAN
> SQLEXEC(lccon)
>ENDSCAN

But they maybe contains the same data?
If not:
Suppose you have cursor with all folders, or array or something else (I prefer cursor).

Lets that cursor has one memo field named mFolder in with you have full path to the folder and file name i.e.
******************************************************
** Rec#     mFolder 
** --------------------------
** 1        c:\MyFolder\tlog
** 2        c:\MyFolder\Sub1\tlog
** 3        c:\MyFolder\Sub2\tlog
** etc.
******************************************************

SQLPREPARE(lccon, [UPDATE mytab SET tdtime=?crsTest.TempT WHERE mytab.PK = ?crsTest.PK])

SELECT MyFolderCursor
SCAN
    lcFileName = ALLTRIM(mFolder)
    SELECT PK, tempt FROM (lcFileName);
           into CURSOR crsTest && With all WHERE, GROUP BY if needed
    SELECT crsTest
    SCAN
       SQLEXEC(lccon)
    ENDSCAN
    SELECT MyFolderCursor
ENDSCAN
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform