Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I disallow duplicate entries in my table?
Message
 
To
21/05/2004 04:37:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00905919
Message ID:
00905929
Views:
16
>how can i not allow duplicate entries in my table? i have an add and save >button in my form. add does an append blank, then save does the >tableupdate. if record is already in my table, i don't want to do a >tableupdate.

>pls help. TIA.

Hi Evelyn,

Kung sa VFP Tables ka lang nag-aadd ng records, puwede kang maglagay nang validation rule.


Halimbawa,Sample lang to ha..

Meron kang Customers table with field na custid, unique at d eto running numbers. Code..


valid procedure for Txtcustid:
cCustid = Alltr(this.value)
Select("Customers")
Set order to tag CUSTID
GO TOP
IF !EOF() .OR. !BOF()
   Set Exact on
   Seek(cCustid)
   If Seek(cCustid)
      Messagebox("Duplicate records or records exist!",0+16,"Add",1900)
      return 0
   Endif
   Set exact off
Endif


Applicable to sa pang-isahang record, isa pa, kung may Invoice Table, dapat meron ka ring unique field Invc_nbr


Ngayon, kung SQL Server data naka store your records mo, kailangang magexecute ka ng stored procedure against sa table at hanapin kung may kapareho na siyang record at ibalik sa user.


Umpisan mo ang validation sa umpisa pa lang, huwag sa pag nagsave ka na ng record.Mas magandang validation yong umpisa para d sayang ang pag keyin ng User mo.


Puwede ka ring magcreate ng Database Triggers..
Jojo R. dela Cuesta, B.Sc.
eConsultant, Programmer
Dalplus Technologies
http://www.dalplus.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform