HI friends,
my project is developped in Visual Foxpro 9 SP1 installed on windows
2000 server. more than 100 client of Windows XP are working on it.
all tables in data environment are set optimistic table buffering
except CMS_IDS. Which is used to generate next available id. to get
new id i use the following procedure. e.g. i want to get new book_id
to use in lm_book_master.
fn_room_id = get_new_id("BOOK_ID")
the code to generate get_new_id is..
PROCEDURE get_new_id
PARAMETERS lc_key AS CHARACTER
SELECT cms_ids
FLOCK("CMS_IDS")
LOCAL ln_new_id AS INTEGER
LOCATE FOR lc_key NOOPTIMIZE
IF FOUND()
ln_new_id = last_id + 1
REPLACE last_id WITH ln_new_id
ELSE
ln_new_id = 1
INSERT INTO cms_ids (KEY,last_id) VALUE (lc_key,ln_new_id)
ENDIF
UNLOCK IN cms_ids
RETURN ln_new_id
ENDPROC
************
Now the problem is some time a record exist with BOOK_ID but it
appears as not found and new record will be added with value 1. why
this happen, any suggesstion, soory for my poor english.