 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bear Guest
|
Posted: Thu Mar 15, 2007 8:11 am Post subject: Is TDataSetProvider none-status? |
|
|
Hi ,
In a real project, we need reuse a sincle DatasetProvider for different
dynamic Clientdataset.
We set DataSetProvider.Options include poAllowCommandText and set
ResolveToDataSet=False.
see below for the test program source code,
the last CDS.ApplyUpdates(-1);will cause error, "can not find record"
because it think current table name is Test2 not Test.
in VCL source code :
procedure TSQLResolver.InitTreeData(Tree: TUpdateTree)
begin
.....
if TableName = '' then
TableName := IProviderSupport(Tree.Source).PSGetTableName;
....
end;
I Think the Provider should get table name from current ClientDataSet who
send ComandText.
It should not use the TableName of last time.
How do you think?
======= Source Code ==============
procedure TForm1.TestClick(Sender: TObject);
var M : string;
begin
M := 'GGGTTTTTTTTTTTT!!!!!!!!G';
CDS.Active := False;
CDS.CommandText := 'select * from Test';
CDS.Active := True;
CDS.Edit;
CDS.FieldByName('T').AsWideString := M;
CDS.FieldByName('S').AsWideString := M;
CDS2.Active := False;
CDS2.CommandText := 'select * from Test2';
CDS2.Active := True;
CDS2.Edit;
CDS2.FieldByName('T').AsWideString := M;
CDS2.FieldByName('S').AsWideString := M;
CDS2.Post;
// CDS2.ApplyUpdates(-1);
CDS.Post;
CDS.ApplyUpdates(-1); //<---Here will cause error, can not find record
end;
====================
Thanks,
Bear |
|
| Back to top |
|
 |
mrbar2000 Guest
|
Posted: Tue Mar 27, 2007 7:26 pm Post subject: Re: Is TDataSetProvider none-status? |
|
|
You need define the providerflags of primary keys to [pfInkey,
pfUpdate]. So the datasnap wiil found the record |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|