Re: How to refresh DataSourceBrowser in a FrameControl

Fernand Vanrie <[email protected]> Thu, 09 Jun 2011 12:01:23 +0200
Newsgroups gmane.comp.openoffice.dba.devel
Message-ID <[email protected]>
Frank ,

Me again:
when loading a paramerized statement i have aSQL error "Values not set 
for all parameters"
so i load
   aLoaderArguments(1).Name = "CommandType"
     aLoaderArguments(1).Value = 2 'com.sun.star.sdb.CommandType.TABLE
     aLoaderArguments(2).Name = "Command"
    aLoaderArguments(2).Value = "SELECT distinct *   FROM  
pmgdbase.adv_reden_tbvips  WHERE pmgdbase.adv_reden_tbvips.REDENID = ? "

how do i can "load" mi "?" parametervalue
i supose something like
aLoaderArguments(6).Name = "CommandParameter 1" ???
aLoaderArguments(6).value = sID

Grzt

Fernand

> Hi Fernand,
>
>> Thanks, now i have my Model and can reload, but the reloading do not
>> affects the activecommand ? an not the results
>>
>> So how to make the new Loaderarguments ("active") or how to pass a new
>> activecommand to the DatasourceBrowser
> Ah - I missed, in your original mail, that you actually want to change
> the command underlying the DSB.
>
> The simplest way might be to just set the "Command" property of the
> database form (the model you just retrieved) before reloading.
>
> A slightly more complex, but cheaper (in terms of runtime resources)
> solution would be to base the DSB on a parametrized statement ("...
> WHERE REDENID = ?"), and then use the XParameters.setInt (or whatever
> type the REDENID column has) method:
>    oForm = oController.com_sun_star_awt_XTabController_getModel()
>    oForm.setInt( 1, sid )
>    oForm.reload()
>
>> my code is now:
>>
>>    odlg.getcontrol("Grid2").LoaderArguments = aLoaderArguments2 ' the new
>> arguments with a new SQL statement in it
> The LoaderArguments are used at the time the DSB is plugged into the
> frame, and then discarded (at least as far as the DSB is concerned, not
> sure the FrameControl implementation makes later use of it). Thus,
> reload does know nothing 'bout changed LoaderArguments, so this doesn't
> work.
>
>>    oDatasourceBrowser = odlg.getcontrol("Grid2").frame.controller
>>    omodel = oDatasourceBrowser.com_sun_star_awt_XTabController_getModel()
>>    omodel.reload
> As said above,
>    oModel.Command =<new_command>
> before doing the reload should help already.
>
> Ciao
> Frank

-- 
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help