Hi Peter, > After > oContext = CreateUNOService("com.sun.star.sdb.DatabaseContext") > oDataSource = oContext.getByname(MyURL) > oDataSource.Settings.addProperty("inactivity-timeout",0,"600") > > I can find this new Property in the Settings, but not in the "Info" member. > But it seems not to be persistent, shouldn't I find an entry in the > content.xml? > (I tried with closed and opened document)
There's some code for the info sequence, which only includes properties from the settings which are not default (this is a feature, else Info would be crowded). After addition of a property, it is automatically assumed to be default, even if it does not have the MAYBEDEFAULT property attribute set. I submitted issue 78593 to change this (i.e. respect the not-set MAYBEDEFAULT). For the moment, you can do a setPropertyValue after the addProperty, then it appears also in the Info sequence. After saving the document, it also appears in the extracted content.xml. > aInfo() = oDataSource.Info > i = UBound(aInfo())+1 > Dim aInfoNew(i) as new com.sun.star.beans.PropertyValue > For n = 0 to UBound(aInfo()) > aInfoNew(n).Name = aInfo(n).Name > aInfoNew(n).Value = aInfo(n).Value > next > aInfoNew(i).Name = "inactivity-timeout" > aInfoNew(i).Value = "600" > oDataSource.Info = aInfoNew() > > without success, oDataSource.Info isn't modified. The same problem strikes here: When you modify the Info member, this is implicitly forwarded to the Settings. When you ask for Info, again, this is retrieved from the Settings - and again the data source assumes the property is default, since it has just been added. >> If this doesn't work for whatever reasons (I'd be interested in the >> results), then try doing a reload at the form after you have set the >> connection - this should force the form to use the new connection. If >> this doesn't work, too - then more details about how you do this, please. >> > > If bNewCon = false then 'global flag > oCon = oDriver.getConnectionWithInfo(sDatabaseURL,mDBProperties()) > wait 1000 > oForm.Reload() > > wait 5000 'yes, should create a XLoadListener here > For i = 0 to UBound(oForm.ActiveConnection.Metadata.ConnectionInfo()) > sTmp = sTmp & CHR(13) & > oForm.ActiveConnection.Metadata.ConnectionInfo(i).Name > next > msgBox sTmp > 'without inactivity-timeout > For i = 0 to UBound(oCon.Metadata.ConnectionInfo()) > sTmp = sTmp & CHR(13) & oCon.Metadata.ConnectionInfo(i).Name > next > msgBox sTmp > 'with inactivity-timeout > bNewCon = true > End If Again, this doesn't work for the same reasons: When the form establishes a connection, it uses Info, not Settings. As explained above, Info doesn't return your newly added setting. The bottom line is: Use a pair of "addProperty" (for initially adding the property) and "setPropertyValue" (for setting it to a different value, which is not considered to be the default) calls, this should (finally) work. Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]