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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only