General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>I am having a problem getting a serial-number table updated.
>
>I have a form MYFORM.scx. In it, I want to fetch the next
>available key value from a table and increment it.
>
>
>
>MYFORM.scx has the following DataEnvironment:
> ULOGKEYS
> USERLIST
> SOITEM
> USERLIST1 (a 2nd copy of USERLIST for dupe checking)
>
>
>ULOGKEYS is a one-field, one-record table. The record holds
>the next available key. When MYFORM.FetchNextKey() is called,
>it should lock the record, return the value, increment the
>field, and unlock the record.
>
>
>
>in MYFORM.Load I have:
> set multilocks ON
>
> =CursorSetProp('Buffering',2,'USERLIST')
> =CursorSetProp('Buffering',2,'SOITEM')
> =CursorSetProp('Buffering',5,'ULOGKEYS')
>
>
>
>in MYFORM.FetchNextKey() I have:
> cRetVal = ULOGKEYS.CurrKey
> nCurrKey = val(ULOGKEYS.CurrKey)
> nNextKey = nCurrKey + 1
> cNextKey = allt(str(nNextKey))
> replace ULOGKEYS.CurrKey with cNextKey
> x = TableUpdate(.t.,.t.,'ULOGKEYS')
> UNLOCK IN ULOGKEYS
>
>
>after the TableUpdate:
> cRetval = "2" && Correct
> nCurrKey = 2.00 && Correct
> nNextKey = 3.00 && Correct
> cNextKey = "3" && Correct
> x = .T. && Correct
>
> BUT:
> ULOGKEYS.CurrKey = "2" && I want it to be "3"
>
>What am I missing?
>
>Thomas G. Hirschman
>
I see your UNLOCK, but where to you LOCK?
Steve
Previous
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