Z
zgjob
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject); <br>var <br> i: Integer; <br>begin <br> with ClientDataSet1 do <br> begin <br> Close; <br> Fields.Clear; <br> FieldDefs.Clear; <br> CommandText := SQLStr1; <br> FieldDefs.Update; <br> with TFieldDef(FieldDefs.Insert(0)) do <br> begin <br> Name := 'FIELD_NAME'; <br> DataType := ftBoolean; <br> DisplayName := 'FIELD_NAME'; <br> end; <br> for i := 0 to FieldDefs.Count - 1 do <br> FieldDefs.CreateField(ClientDataSet1); <br> Fields[0].FieldKind := fkInternalCalc; <br> Open; <br> end; <br>end; <br><br>procedure TForm1.ClientDataSet1CalcFields(DataSet: TDataSet); <br>begin <br> with ClientDataSet1 do <br> begin <br> if Fields[0].Value = Null then Fields[0].AsBoolean := False; <br> end; <br>end; <br>用上面的代码,创建了一个临时的选择列,但如何取出当前dbgrideh已选中的列的第二列的数据?