Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
COPY with memo
Message
 
À
13/11/2014 13:51:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01610927
Message ID:
01610955
Vues:
76
>Boris,
>
>Thanks!
>
>There are quite a number of fields in the table. Is there an easy way to construct the FieldListWithoutMemo, other than doing it by hand?

It is easy to write a function :-)
MyCopy(AliasHere,"c:\test\FooWithoutMemo"      ,0)
MyCopy(AliasHere,"c:\test\FooWithConvertedMemo",1)


*** This is only EXAMPLE, you should add error handling here
FUNCTION MyCopy(lcAlais, lcTargetFile, lnTypeOfMemo)
    LOCAL lcCurrentAlias, laFields[1], lnFields
    LOCAL lnFor, lcSelect
    lcCurrentAlias = ALIAS()
    lnFields = AFIELDS(laFields, m.lcAlias)
    lcSelect = "SELECT "

    FOR lnFor = 1 TO lnFields
        IF laFields[m.lnFor,2] == "M" && Memo
           IF m.lnTypeOfMemo == 1
              lcSelect = lcSelect + [CAST(]+laFields[m.lnFor,1]+[ AS C(255)) AS ]+laFields[m.lnFor,1]+[, ]
           ENDIF
        ELSE
           lcSelect = lcSelect + laFields[m.lnFor,1]+[, ]
        ENDIF
    NEXT
    lcSelect = LEFT(lcSelect,LEN(lcSelect)-2)+" FROM "+m.lcAlias+[ INTO CURSOR crsForCopy"
    &lcSelect
    COPY TO (lcTargetFile)
    USE IN SELECT("crsForCopy")
    IF NOT EMPTY(lcCurrentAlias)
       SELECT (lcCurrentAlias)   
    ENDIF
RETURN
NOT TESTED!!!!
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform