Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Seek() and tableupdate()
Message
From
26/03/1998 11:23:49
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/03/1998 09:42:56
Joao Godinho
Fredesenvolv, Lda
Lisbon, Portugal
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00087270
Message ID:
00087318
Views:
32
>I've a form with a table, and the table have a primary Key, the table is open with buffer mode=5
>When i do a seek Fox preform an automatic tableupdate, and i got an error that the index was violated, because the value i entered in the textfield allready exists.
>What is the best solution for cheking if a value entered allready exists
Support and addition to Rick :
-Never use a user entered key as PK. Use app generated PK. You could generate and use PK in default value (stored procs, insert, update, delete triggers). For single user sys(2015) fits well for PK default value. For multiuser you could add a unique station value to it (ie: sys(0)-Computer name part or netcard physical address).
-To do other type of search and moving rec pointer on a buffered table (or Call another form from a grid while table validation not satisfied etc):
a) Save recno() + current rec contents (ie: scatter to array savearray memo)
b) Fill the record with dummy valid data
c) Use scan...endscan (with recno() check to see if it's your record)
d) Goto org recno() and gather
PS: SQL or use again would return incorrect (I mean recs in buffer wouldn't be taken into account) data for a buffered table.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform