Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New Number
Message
 
 
To
20/11/2000 13:52:46
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00443749
Message ID:
00443765
Views:
11
>I have a table that has pool, hand and number fields. If the user wants to add a new record, I check the table for the pool that the user wants to add a record for. If it isn't in the table, I give that record a number of 1. If it is I want to increment the last number for that pool by one. So there would be multiple records with the value of 1 or any other number for that matter. I can't think of a way to do this. Any help would be appreciated.Thanks,
>
>Tyler

Off the top of my head:
lparameters tnpoolID
lnretval = 0
use pool_table  &&;-)
=cursorsetprop("buffering",2) && pessimistic row
if !seek(tnpoolID) then
   insert into pool_table (key, value) values (tnpoolID,1)
   lnretval = 1
else
   replace key with key && lock record so no one else can get it
   lnretval = key + 1
   replace key with lnretval
endif
if tableupdate() then
   return lnretval
else
   return 0  && error occurred; parse aerrors to find out what
endif
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform