Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help! VFP 7 broke my VFP 6 code
Message
From
01/10/2001 12:37:27
 
 
To
01/10/2001 12:18:17
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00562021
Message ID:
00562641
Views:
31
Ok, it is the long field name that is the problem, but the question remains: Why does it not give you an error until you try to alter the cursor? The cursor works fine until that point. This is quite confusing in that it appears that altering the cursor is causing the error when in fact the error really occured when the cursor was created with long filenames. Why not error at the point the cursor is created? Or better yet, since it seems you can now create a cursor with long filenames, why not make everything work with the long file names?

Thanks,

Michelle


>I think I know what is causing this. In VFP6, if you issue an ALTER TABLE on a cursor with one or more long fieldnames (>10 chars long), the long fieldnames are silently truncated to 10 characters. This happens because in the background ALTER TABLE makes a new free DBF and deletes the original. Because this is a free table, the fieldname lengths are limited to 10 characters. To prevent this silent truncation from happenening in VFP7, we now throw the error "Invalid operation for the cursor" when attempting ALTER TABLE on a cursor with long fieldnames.
>
>Try the following code in VFP6 and VFP7. The field field_name1 is renamed to field_name in VFP6. VFP7 throws the error on the ALTER TABLE command.
>
>CLEAR
>CREATE CURSOR testcur (field_name1 c(8))
>LIST STRUCTURE
>ALTER TABLE testcur ADD COLUMN f2 c(8)
>LIST STRUCTURE
>RETURN
>
>
>Please let me know if you are seeing something different than what I describe above.
>
>Jim Saunders
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform