BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is TDataSetProvider none-status?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier)
View previous topic :: View next topic  
Author Message
Bear
Guest





PostPosted: Thu Mar 15, 2007 8:11 am    Post subject: Is TDataSetProvider none-status? Reply with quote



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





PostPosted: Tue Mar 27, 2007 7:26 pm    Post subject: Re: Is TDataSetProvider none-status? Reply with quote



You need define the providerflags of primary keys to [pfInkey,
pfUpdate]. So the datasnap wiil found the record
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.