ClientDataSetID.Active :=false;
ClientDataSetID.FileName :='c:\ID.xml';
ClientDataSetID.Active :=true;
xml文件如下:
<?xml version="1.0" standalone="yes"?> <DATAPACKET Version="2.0"><METADATA><FIELDS><FIELD attrname="ID" fieldtype="i4"/></FIELDS><PARAMS CHANGE_LOG="4 2 8" LCID="0"><PARAM Name="NO_RESET_CALL" Value="TRUE" Type="boolean"/></PARAMS></METADATA><ROWDATA><ROW ID="4"/><ROW RowState="1" ID="5"/><ROW ID="6"/><ROW RowState="8" ID="5"/></ROWDATA></DATAPACKET>
问题:如何得到字段id的最大值?在sql语句中应该很容易得到select max(id) from rptid ,但在xml中如何操作?
4 个解决方案
#1
高手快来给我看看!!1
#2
高手快来给我看看!!1
#3
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientDataSet1.Active := false;
ClientDataSet1.IndexFieldNames := 'id';
ClientDataSet1.Active := true;
ClientDataSet1.Last;
edit1.Text := ClientDataSet1.FieldValues['id'];
end;
begin
ClientDataSet1.Active := false;
ClientDataSet1.IndexFieldNames := 'id';
ClientDataSet1.Active := true;
ClientDataSet1.Last;
edit1.Text := ClientDataSet1.FieldValues['id'];
end;
#4
Mark
#1
高手快来给我看看!!1
#2
高手快来给我看看!!1
#3
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientDataSet1.Active := false;
ClientDataSet1.IndexFieldNames := 'id';
ClientDataSet1.Active := true;
ClientDataSet1.Last;
edit1.Text := ClientDataSet1.FieldValues['id'];
end;
begin
ClientDataSet1.Active := false;
ClientDataSet1.IndexFieldNames := 'id';
ClientDataSet1.Active := true;
ClientDataSet1.Last;
edit1.Text := ClientDataSet1.FieldValues['id'];
end;
#4
Mark