How to find repeated records

zhaozj2021-02-16  95

You can judge in the oncolexit event. If you have 5 fields: A, B, C, D, E; then define 5 string variables: String Sa, SB, SC, SE; then write: void __fastcall tform1 :: dbgrid1coleXit (TOBJECT * Sender) {INT i; I = dbgrid1-> selectedindex; switch (i) {case 0: sa = trim (dbgrid1-> selectedfield-> text); break; case 1: sb = trim (dbgrid1-> selectedfield-> text); IF (SA == SB) {ShowMessage (SB); Abort ();} Break; Case 2: SC = Trim (DBGRID1-> SELECTEDFIELD-> text); if (sc == sa || sc == sb) { ShowMessage (SC); Abort ();} Break; Case 3: SD = Trim (DBGRID1-> SELECTEDFIELD-> Text); ShowMessage, " SB ", " SC ", " SD); IF SD == SA || SD == SB || SD == SC) {ShowMessage (SD); Abort ();} Break; Case 4: SE = TRIM (DBGRID1-> SELECTEDFIELD-> Text); if (SE = = sa || SE == SB || SE == SC || SE == SD) {showMessage (se); abort ();} Break; case 5: sf = trim (dbgrid1-> selectedfield-> text); if (sf == sa || sf == SB || sf == sc || sf == SD || sf == SE) {ShowMessage (sf); SA = ""; SB = "; SC =" "; sd ="; se = ""; sf = ";);

Break;}}

转载请注明原文地址:https://www.9cbs.com/read-11281.html

New Post(0)