Finds the index of a field object in the Fields array from the field object.function IndexOf(Field: TField): Integer;DescriptionCall IndexOf to get the index for a field in the Fields array. Specify the field as the Field parameter. The first field in the array has index 0, the second field has index 1, and so on. If a field is not in the Fields array, IndexOf returns -1.

解决方案 »

  1.   

    函数indexof并不能判断哪个字段是关键字字段,只是取到每个字段的序号。
      

  2.   

    函数indexof并不能判断哪个字段是关键字字段,只是取到每个字段的序号。
      

  3.   

    var
      i:integer;
    begin
      for i:=0 to datam.ADOQ_lgbjbda.FieldCount -1 do
          if datam.ADOQ_lgbjbda.FieldList.Fields[i].IsNull do
             showmessage('该字段不允许为空!')
      

  4.   

    var
      i:integer;
    begin
      for i:=0 to datam.ADOQ_lgbjbda.FieldCount -1 do
          if datam.ADOQ_lgbjbda.FieldList.Fields[i].IsNull do
             showmessage('该字段不允许为空!'