学了9天了,真惭愧
str2 := dbedit2.EditText;
datak.scQuery1.Cancel;
datak.scQuery1.Locate('no',str2,[]);
可以定位关联datafield的字段查询
但是加了几个新的dbeidt.怎么用1个按钮查询
if语句好像不行哦

解决方案 »

  1.   

    另外如果发现有重复的字段,怎么输出到重复的行数到一个edit里去
      

  2.   

    Call Locate to search a dataset for a specific row and make it the current row.KeyValues is a variant that specifies the values to match in the key fields. If KeyFields lists a single field, KeyValues specifies the value for that field on the desired row. To specify multiple search values, pass a variant array as KeyValues, or construct a variant array on the fly using the VarArrayOf routine. For example:with ADOTable1 do
      Locate('Company;Contact;Phone', VarArrayOf(['Sight Diver', 'P', '408-431-1000']), [loPartialKey]);
      

  3.   

    建议用QUERY控件,不赞成用TABLE控件,以后维护也麻烦。直接用SQL语句不是更好吗?
      

  4.   

    同上,最好别用TTable控件,麻烦。
      

  5.   

    别用这种方式,直接写sql语句,用Adoquery.
      

  6.   

    onDBEditXXXChange
    LastCtrl := DBEditXXX
    or
    LastCtrl := TDBEdit(Sender)
    str2 := LastCtrl.EditText;
      

  7.   

    直接用TADOCOMMAND吧,比TADOQUERY要强大,TADOQUEY是基于他上面的