ÎÒÏëʵÏÖÒÔϹ¦ÄÜ£¬ÔÚform1ÖеÄeditÎı¾¿òÖÐÊäÈëµ¥ºÅ£¬±£´æÊ±ÅжÏÕâ¸öµ¥ºÅÊÇ·ñ´æÔÚÓÚÁíÍâÈý¸ö±í£¬ ±ítable1,table2,table3Öе¥ºÅÒÔ²»Í¬×ֶαíʾ£¬±ÈÈ磬dh1£¬dh2£¬dh3. ²»ÖªµÀ¸ÃÔõôдÁË¡£select count(1) as aNum from ( select dh1 from table1 where dh1=QuotedStr(edit1.text) union all select dh2 from table2 where dh2=QuotedStr(edit1.text) union all select dh3 from table3 where dh3=QuotedStr(edit1.text) ) as p
if not exists (select dh1 from table1 where dh1=QuotedStr(edit1.text)) select -1 else if not exists (select dh1 from table2 where dh1=QuotedStr(edit1.text)) select -2 else if not exists (select dh1 from table3 where dh1=QuotedStr(edit1.text)) select -3 else select 0
ÄǾÍֻҪͳ¼Æ³öÀ´µÄaNum>=1¼´¿ÉÁË
µ¥ºÅ´æÔÚÓÚÁíÍâÈý¸ö±íÖеÄÈκÎÒ»¸ö¶¼ÐУ¡ ת»»³ÉdelphiÓïÑÔÄØ£¬ÓÃquery×é¼þ£¬Ì«±¿ÁË£¬³õѧÕß with adoquery1 do begin close;sql.clear; sql.add('select count(1) as aNum from '); &nbs
IF THEN ELSEÖжà¸öÌõ¼þÔõôд£¬È磺×Ö·û´®S1£¬S2£¬S3£¬S4¾ùÒª²»Îª¿Õ¡£ ÔõôÑù°ÑËüдµ½IFÖÐÈ¥£¿ Çë¸÷λ°ï°ï棬лл£¡ if (S1<>'') and (S2<>'') and (S3<>'') and (S4<>'') then begin ......