Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replace field with blank (space)
Message
De
28/03/2007 02:20:08
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01208793
Message ID:
01209095
Vues:
31
hi,
i try as under, error message Invalid subscript reference
CLOSE all
*use answers excl
select answers excl
local lnI
local array laFields[1]
afields(laFields)
if inlist(laFields[m.lnI,2],'N','B','I')&&Invalid subscript reference 
   if not laFields[m.lnI,5] && &&Invalid subscript reference 
       try
         ALTER TABLE MyTable  ALTER COLUMN (laFields[m.lnI,1]) NULL
       catch to loError
          llError = .t.
       endtry
   endif
   if not m.llError
       replace (laFields[lnI,1]) with null for empty(&laFields[lnI,1])
   endif
endif
brow
>Can you change the structure of your table/cursor? All these fields should allow NULL for this to work.
>
>If your table is opened exclusive, you can change the structure programmatically:
>
>if inlist(laFields[m.lnI,2],'N','B','I')
>   if not laFields[m.lnI,5] && Nulls are not allowed for this field
>       try
>         ALTER TABLE MyTable  ALTER COLUMN (laFields[m.lnI,1]) NULL
>       catch to loError
>          llError = .t.
>       endtry
>   endif
>   if not m.llError
>      replace ...
>   endif
>endif
>
>>error message
>>Field "name" does not accept null value??
>>type is double??
>>
>>select answers
>>local lnI
>>local array laFields[1]
>>afields(laFields)
>>for lnI = 1 to alen(laFields,1)
>>if inlist(laFields[m.lnI,2],'N','I','B') && Numeric, double or Integer
>>    replace (laFields[lnI,1]) with null for empty(&laFields[lnI,1])
>>endif
>>next
>>brow
>>
>>
>>
>>>Post back your whole code. Do you use alen(laFields,1) in your loop? If yes, it should work.
>>>
>>>>error message
>>>>Invalid subscript reference
>>>>if inlist(laFields[m.lnI,2],'N','I','B')
>>>>>Try
>>>>>
>>>>>if inlist(laFields[m.lnI,2],'N','I','B') && Numeric, double or Integer
>>>>>   replace ...
>>>>>endif
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform