Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
1707 Error using ALTER TABLE
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
1707 Error using ALTER TABLE
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01347518
Message ID:
01347518
Views:
55
I just ran into some strange behavior using ALTER TABLE that I can't make any sense out of. It seems that if I have a cursor open that has a cdx index (with or without an active tag), and I have an error handler defined with ON ERROR, I will get a 1707 "Can't find structural CDX index" error when I issue an ALTER TABLE command. As soon as I turn off the error handler, the ALTER TABLE works just fine.

I can code around it with a TRY/CATCH and by turning off the ON ERROR just before running the ALTER TABLE, but I was just curious if anyone else has run into this. I've added a few lines of code below to reproduce the error.

Thanks,

-m@
PRIVATE glWasErr
glWasErr = .F.

CREATE CURSOR c_Test1 (nada C(10), Other L, More D, YetMore I)
INDEX on YetMore TAG YetMore

IF 6 = MESSAGEBOX("Run with error handler on?",4+32, "Select Test Method")
  ON ERROR DO ErrHand 
ELSE
  ON ERROR 
ENDIF 

IF VARTYPE(TestCol1) <> "C"
  ALTER TABLE c_Test1 ADD COLUMN TestCol1 C(20)
ELSE
  ALTER TABLE c_Test1 DROP COLUMN TestCol1 
ENDIF

IF ! glWasErr
  =MESSAGEBOX("Ran fine, no errors.", 64, "No Problems")
ENDIF 

*--------------------------------------------------------------------------
PROCEDURE ErrHand
*
glWasErr = .T.
=MESSAGEBOX("Error " + TRANSFORM(ERROR()) + " " + MESSAGE(), 16, "BANG!!!")
Next
Reply
Map
View

Click here to load this message in the networking platform