problem with TClientDataSet working with ADO


2004-09-22 08:37:44 AM
delphi228
Hi.
-----------------------------------------------------------------
I met a problem, hope someone can help me.
TADOQuery=>TDataSetProvider=>TClientDataSet
(1). TADOQuery.SQL.Text:='select count(accno) as accno from dr_accs'
(2). TADOQuery.SQL.Text:='select accno from dr_accs'
when I use follow statements, It will pop an error-'Trying to modify
read-only field' with the number (1) ADOQuery statment,
however, when I use number (2) ADOQuery statement for testing, it can work.
TClientDataSet.Open;
TClientDataSet.Edit;
TClientDataSet.FieldByName('accno').ReadOnly:=False;
TClientDataSet.FieldByName('accno').AsInteger:=100;
TClientDataSet.Post;
TClientDataSet.Close;
I also tested DBX with the same situation, but it seems it can work for
both.
Can anyone help me to let the number(1) ADOQuery statement can work for ADO?
Thanks a lot!
Bin.