Subject | IBO copy to CDS is create an error |
---|---|
Author | fowlertrainer |
Post date | 2003-11-20T09:58:48Z |
Dear Jason W. !
I use CDS to local caching. My CDS is a modified: I don't use
provider, because it is copy the FieldDefs, and some cases the IBO
Queries is get with ReadOnly fields - this cause that the CDS is get
as ReadOnly.
My CDS is copy the IBOQuery by record to record.
But I get problems with this example code:
qry:=TIBOQuery(CreateAndSetQuery('a',Self,'select * from test',
False));
CreateUpdateSQLOnQuery(qry);
qry.Open;
end;
DataSource1.DataSet:=qry;
cds:=TClientDataSet.Create(Self);
cds.FieldDefs.Assign(qry.FieldDefs);
cds.FieldDefs[0].Required:=False;
cds.FieldDefs[1].Required:=False;
cds.FieldDefs[2].Required:=False;
cds.FieldDefs[3].Required:=False;
cds.CreateDataSet;
with qry do begin
First;while not Eof do begin
cds.Append;
CopyRecord(qry,cds);
cds.Post; // Error !!!
Next;
end;
end;
So I cannot understand, why it is drop a "Field is required"
exception.
In this time I make mistake in code, because I write this:
cds.FieldDefs[4].Required:=False;
In this case the program is running, and no make exception !!!!
I check this hided FieldDef - it is named DB_KEY5.
Why it is exists ?
It is RDB$KEY of the table ?
Please help me !!!
Thanx:
KK
I use CDS to local caching. My CDS is a modified: I don't use
provider, because it is copy the FieldDefs, and some cases the IBO
Queries is get with ReadOnly fields - this cause that the CDS is get
as ReadOnly.
My CDS is copy the IBOQuery by record to record.
But I get problems with this example code:
qry:=TIBOQuery(CreateAndSetQuery('a',Self,'select * from test',
False));
CreateUpdateSQLOnQuery(qry);
qry.Open;
end;
DataSource1.DataSet:=qry;
cds:=TClientDataSet.Create(Self);
cds.FieldDefs.Assign(qry.FieldDefs);
cds.FieldDefs[0].Required:=False;
cds.FieldDefs[1].Required:=False;
cds.FieldDefs[2].Required:=False;
cds.FieldDefs[3].Required:=False;
cds.CreateDataSet;
with qry do begin
First;while not Eof do begin
cds.Append;
CopyRecord(qry,cds);
cds.Post; // Error !!!
Next;
end;
end;
So I cannot understand, why it is drop a "Field is required"
exception.
In this time I make mistake in code, because I write this:
cds.FieldDefs[4].Required:=False;
In this case the program is running, and no make exception !!!!
I check this hided FieldDef - it is named DB_KEY5.
Why it is exists ?
It is RDB$KEY of the table ?
Please help me !!!
Thanx:
KK