Am Freitag, den 08.02.2008, 11:22 -0500 schrieb Drew Jensen:
> Hi,
> 
> I am hoping someone can help with this.
> 
> Need to open a ( execute ) a query from a Basic script.
> 
> Not sure if I am on the right track -
> 
> aconnection.queries.getByName( <queryName >)
> 
> That gets me the query definition and this has the function execute so
> 
> aconnection.queries.getByName( <queryName >).execute( <parameters>)
> 
> 1 ) Am I going about this correctly?
> 2) If so could really use some help on setting up the paramters for the 
> execute function.
> 
> Thanks in advance

I've been fiddling a little with this, too. Well, maybe I didn't spend
my night on it ... ;)

This one does it, it has to have all three properties "Command",
"CommandType" and "DataSourceName", otherwise it does not open the
query:

sub LoadQuerytest
        it = ThisComponent.DrawPage.Forms(0)
        doc = LoadQuery(it, "Spielwiese", "Wert_Gr_200")
        dbgI(doc)
end sub

' STATE: working OKAY
function LoadQuery(doc as object, dsname as string, qname as string)
        dim args(2) as new com.sun.star.beans.PropertyValue
        args(0).Name = "Command"
        args(0).Value = qname
        args(1).Name = "CommandType"
        args(1).Value = com.sun.star.sdb.CommandType.QUERY
        args(2).Name = "DataSourceName"
        args(2).Value = dsname
        
        LoadQuery = 
StarDesktop.loadComponentFromURL(".component:DB/DataSourceBrowser", "_default", 
0, args())
end function

The only thing missing is hiding the tree, but you guys got that
working, IIRC.

Look at

<SDK>docs\common\ref\com\sun\star\sdb\DataSourceBrowser.html

at the description of "XInitilization", as Frank told me a while ago. In
the head of that page the mystery of using dispatch with the DBBrowser
is explained.

Have fun,
Marc



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to