Subject | Re: [IBO] How to send component name as parameter to access IBO component's methods |
---|---|
Author | Helen Borrie |
Post date | 2001-06-01T08:41:14Z |
At 12:41 AM 01-06-01 -0700, you wrote:
Don't forget to destroy AStatement when you have finished with it. Do that in the method (handler) that creates it, i.e. as soon as you have created the object variable, open a try...finally loop. Put everything inside the try... block and put the .Free call for the variable in the ..Finally block.
Apologies to any space visitors out there who are trying to analyse human language from this email.
Cheers,
Helen
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>Helen:If they are all components of the same class, you can. Let's say they are all TIB_DSQL... then you can write a generic procedure that works for *any" object of that class. But you can't pass the component name as a string, you need to pass it as a member of that class. So, first declare and create a variable of that class (e.g. AStatement: TIB_DSQL), instantiate it (call its Create method), assign the appropriate component to it and pass it (AStatement) in your procedure call. Then your procedure just works on AStatement, which acts as a pointer to the component that was assigned to it.
>
>Thanks for the quick reply, your great!
>
>So what I gather from your pseudo code is that I still have to list a long series of
>components and the various methods that I want to access, one set for each component.
>It doesn't look like I can simply list :
>
><some component>.prepare;
><some component>.ParamByName('ClientID').AsInterger......(from your previous help)
><some component>.execute;
Don't forget to destroy AStatement when you have finished with it. Do that in the method (handler) that creates it, i.e. as soon as you have created the object variable, open a try...finally loop. Put everything inside the try... block and put the .Free call for the variable in the ..Finally block.
Apologies to any space visitors out there who are trying to analyse human language from this email.
Cheers,
Helen
>where I change the <some component> based on what I pass to the procedure?All for Open and Open for All
>
>What I'm trying to do here is save about 10 minutes of time by spending 2 hours of
>figuring out how to do it! <BG>
>
>Thanks again,
>
>Chuck
>
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________