Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Creating a Query at Runtime
Tue, May 8 2007 8:48 PMPermanent Link

Richard Harding
I wish to create a query at runtime.  When the program attempt to open the query, the
error "Invalid session name sesTest" occurs.  I reckon the the session exists, but
ElevateDB disagrees.  The session name is copied from an existing query.

Does anyone have any idea of what I am doing wrong?

Thank you . .

Richard Harding . . .

var
  ChildQuery:      TQuery;
  ChildDataSource: TDataSource;

begin
  ChildDataSource := TDataSource.Create(Self);
  ChildDataSource.Name := 'ChildDataSource' + IntToStr(node.Level + 1);
  ChildQuery := TQuery.Create(Self);
  ChildDataSource.DataSet := ChildQuery;

  with ChildQuery do
  begin
     ChildQuery.SQL.Assign(dmData.qyChildNodes.SQL);
     ChildQuery.Params.Assign(dmData.qyChildNodes.Params);
     ChildQuery.SessionName := dmData.qyChildNodes.SessionName;  // Session name assigned
from existing query.
     ChildQuery.DatabaseName := dmData.qyChildNodes.DatabaseName;
     if LastDS = nil
        then ChildQuery.DataSource := dmData.dsChildNodes
        else ChildQuery.DataSource := LastDS;
     ChildQuery.Active := true;
  end;

  LastDS := ChildDataSource;
end;
Wed, May 9 2007 3:06 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Richard


I presume this is a simple typo

ChildQuery := TQuery.Create(Self);


Roy Lambert
Wed, May 9 2007 5:36 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Richard,

<< I wish to create a query at runtime.  When the program attempt to open
the query, the error "Invalid session name sesTest" occurs.  I reckon the
the session exists, but ElevateDB disagrees.  The session name is copied
from an existing query. >>

See Roy's response - it looks like you're creating a TQuery, not a
TEDBQuery.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, May 9 2007 6:14 PMPermanent Link

Richard Harding
Thanks Roy & Tim.

I spent a LONG time trying to work this out . . .

Richard . . .
Thu, May 10 2007 5:41 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Richard


Sometimes you're just to close to the problem. Next time walk at least 20ft away from the screen and then look Smiley


Roy Lambert
Image