Subject Re: [IBO] OT: String->Query
Author guido.klapperich@t-online.de
But this only work, if Application is the owner of the datamodule.

Guido

Luiz Alves wrote:

> Try it,
>
> procedure TForm1.Button2Click(Sender: TObject);
> var t:Tcomponent;
> begin
> t:=Convert('dm.IB_Query1');
> if assigned(t) then
> if (t is tib_query) then begin
> IB_DataSource1.DataSet:=tib_query(t);
> tib_query(t).open;
> end;
> end;
>
> function TForm1.Convert(AName:string):Tcomponent;
> var p:Integer;
> sQuery,sDataModule:String;
> t,dm:Tcomponent;
> begin
> result:=nil;
> p := Pos( '.', AName );
> if (p = 0) then Exit;
> sDataModule := Copy( AName, 1, p-1 );
> Delete( AName, 1, p );
> sQuery := AName;
> dm:=application.FindComponent(sDataModule);
> if not assigned(dm) then exit;
> t:=dm.FindComponent(sQuery);
> if assigned(t) then
> result:=tib_query(t)
> end;
>
> ----- Original Message -----
> From: <guido.klapperich@...>
> To: IBObjects <IBObjects@yahoogroups.com>
> Sent: Sunday, April 08, 2001 6:14 PM
> Subject: [IBO] OT: String->Query
>
> > I have a string 'CustomersDataModule.CSQuery' and I want to convert this
> > string to a IB_Query.
> > I want something like that:
> >
> > var Query; TIB_Query;
> > begin
> > Query:=Convert('CustomersDataModule.CSQuery');
> > Query.Open;
> > end;
> >
> > Is this possible ?
> >
> >
> > Guido.
> >
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/