General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
PMFJI, but the NewId table needs to be a table so you can lock the record until the value is iterated. If it were a view, two users could get the same value for the key but only one could update the underlying table correctly.
HTH
Rex
>I'm using a NewID() function to lookup "NextKey" values for adding records to my database. This function suites my needs perfectly when it works, but for some reason, it doesn't always work. I haven't pinned down what changes occur in my project that disable this function, but they're NOT changes in the DB, as that has been unchanging.
>
>* Excerpt from function NewID()
>*=================================
>IF ! USED("rv_nextkey")
> USE "eis!rv_nextkey" IN 0
>ELSE
> REQUERY("rv_nextkey")
>ENDIF
>
>IF _TALLY = 1
> MESSAGEBOX("_Tally was successfull")
> SELECT rv_nextkey
> llSuccess = .F.
> DO WHILE ! llSuccess
> lnRetVal = rv_nextkey.nextkey
> REPLACE rv_nextkey.nextkey WITH rv_nextkey.nextkey + 1
>*etc..
>*=================================
>
>I've been stepping through the above code and for some reason the USE "eis!rv_nextkey" IN 0 isn't returning _TALLY = 1
>
>The entry for _TALLY in Hacker's Guide doesn't list USE as being a command that changes _TALLY, but, as I said, this code does work sometimes. (The code actually came from another FVP book, so somebody else thought it should work as well).
>
>Browsing the NextKey table with the correct parameters gives the expected results, I just can't figure out why this function is inconsistent.
>
>Any suggestions?
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