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 

Re: delphi 7 clearing the params of client data sets

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





PostPosted: Thu Mar 03, 2005 9:00 pm    Post subject: Re: delphi 7 clearing the params of client data sets Reply with quote



<user (AT) domain (DOT) invalid> wrote

Quote:
I have a client dataset with a parameter :
cdsOne : TClientDataSet => Param1 => paramtype = ptInput, field type
ftInteger.

In the appserver, I have a TIbQuery with the same param, and a data set
provider.

Back in the client, I have a method :

RequeryTheCds(aParam : Integer) ;
begin
with cdsOne do
begin
Active := False ;
Params.ParamByName('Param1').AsInteger := aParam ;
Active := True ;
end ;
end ;

If I compile this code with delphi 6 it works ok all the time.
If I compile this code with delphi 7 it only works when the parameter
passed into the function ReQueryTheCds(aParam) is different from the one
passed immediately before : ie, if I try to query twice for the same
parameter, the second time the parameter gets converted to a null.

I ran into the same problem after moving from D6 to D9. I've entered a QC
entry for it (#10773) although my original problem was slightly different.

My work-around for now is to use a custom TClientdataset component. You
only need to override the DoGetRecords Method and comment out the call to
UnPackParams():

Type
TFixedClientDataSet = class(TClientDataSet)
protected
function DoGetRecords(Count: Integer; out RecsOut: Integer; Options:
Integer;
const CommandText: WideString; Params: OleVariant): OleVariant;
override;
end;

function TFixedClientDataSet.DoGetRecords(Count: Integer; out RecsOut:
Integer;
Options: Integer; const CommandText: WideString; Params: OleVariant):
OleVariant;
var
OwnerData: OleVariant;
begin
DoBeforeGetRecords(OwnerData);
Result := AppServer.AS_GetRecords(ProviderName, Count, RecsOut, Options,
CommandText, Params, OwnerData);
// Comment out the following line to fix params being cleared
// UnPackParams(Params, Self.Params);
DoAfterGetRecords(OwnerData);
end;

Dan



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.