Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does anyone have a NEXTKEY() prog that can do this
Message
From
05/01/2002 11:18:11
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Does anyone have a NEXTKEY() prog that can do this
Miscellaneous
Thread ID:
00601141
Message ID:
00601141
Views:
66
I have sometimes have trouble when opening 2 Database containers containing
the same NEXTKEY() stored proc.

IF I forget to use SET DATABASE TO then very often the nextkey routine will use the wrong nextkey table when I do an insert.

The solution I would like to see is a change to my nextkey() SP so that it ensures the keytable being used lives in the same DBC as the table requiring a new key.

something like.
lcDBC = cursorgetprop('database') && hopefully this will contain the name of the dbc() for the table being operated on but I am not sure

* --- Open table of next keys
If USED("NextKey") and dbc('database','nextkey')<>lcDBC
	use in  NextKey
endif

If USED("NextKey") 
   select nextkey
else
   Use (lcDBC+'!'+'nextkey')
Endif
I dont have the time to make and test this myself so I am hoping someone else has already done this somewhere
Next
Reply
Map
View

Click here to load this message in the networking platform