Hi Fernand, > Are you sure you didn' tryed with user/password before you tryed the > activeconnection, because OO remembers the connection made by > user/password ?
Yes. > The code who works but is asking for User and pasdword: > > > Dim aProps(7) as New com.sun.star.beans.PropertyValue > aProps(0).Name = "DataSourceName" > aProps(0).Value = "mysql_native" ' deze "naam" moet dus GEREGISTREERD > ZIJN als Database in OO > aProps(1).Name = "CommandType" > aProps(1).Value = 0 > aProps(2).Name = "Command" > aprops(2).value = "pmgdbase.mag_news_export" > > The code who do not works : > > oDB = CreateUnoService("com.sun.star.sdb.DatabaseContext") > oConn = > oDB.GetByName("mysql_native").GetConnection("user","password") > ' xray oconn > Dim aProps(7) as New com.sun.star.beans.PropertyValue > aProps(0).Name = "ActiveConnection" > aProps(0).Value = oconn > aProps(1).Name = "CommandType" > aProps(1).Value = 0 ' 0 = tabel , 1 = query , 2 = SQL statement > aProps(2).Name = "Command" > aprops(2).value = "pmgdbase.mag_news_export One difference I see here is that you do *not* pass the DataSourceName in the second case (my macro here does). This might make the difference - can you try passing it, additional to the ActiveConnection? Is your oconn object, by any chance, invalid? Ciao Frank -- ORACLE Frank Schönheit | Software Engineer | frank.schoenh...@oracle.com Oracle Office Productivity: http://www.oracle.com/office --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org For additional commands, e-mail: dev-h...@dba.openoffice.org