Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Null value backward compatibility
Message
 
To
20/01/2007 05:54:44
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01187313
Message ID:
01187360
Views:
22
>I have a completely working application in Foxpro 7 that works without problems with free tables.
>
>However when i want to convert this app to foxpro 9 i get several errors when i replace fields with memory variales. The error is field xxx cannot accept null values.
>
>I know that this is a option on the structure, however there are more that 200 free tables in the project! Some contain > 100 fields.
>
>Is there a general option to solve this quick?
>
>Thanks in advance
>
>Piet Koemans

Hi Piet
See if this help
Tested and worked but Backup your files befor
CLOSE DATABASES ALL
SET EXCLUSIVE ON

lcDefaDir = [C:\Test_Vfp\MyData]   &&& write here the path to yours dbf's
SET DEFAULT TO (m.lcDefaDir)

lnFiles = ADIR(myFiles,[*.dbf])

FOR lnVar = 1 TO lnFiles
    lcCurDbf = m.MyFiles(m.lnvar,1)
    USE (m.lcCurDbf)
    lnNumFields = AFIELDS(arrayFields)
    
    FOR ln2Var  = 1 TO m.lnNumFields
        TEXT TO myVar TEXTMERGE NOSHOW PRETEXT 15
             ALTER TABLE <<JUSTSTEM(m.lcCurDbf)>> ALTER COLUMN <<arrayFields(m.ln2Var,1)>>
                         <<arrayFields(ln2Var,2)>> (<<arrayFields(ln2Var,3)>>
                         <<IIF(arrayFields(m.ln2Var,2) = "N",","+TRANSFORM(arrayFields(m.ln2Var,4)),[])>> ) NULL
        ENDTEXT
        ? m.myVar
        EXECSCRIPT(m.myVar)
    NEXT
    
NEXT

DELETE FILE [*.BAK]
DELETE FILE [*.TBK]
CLOSE DATABASES ALL
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform