‎20-12-2018 09:35 AM
Hi,
I want to download a certain set of data from all my MegaDatabase (repositories) at once. So I wrote a VB.net application that did the job for me. In MEGA 2009 this worked perfectly, but now within HOPEX V2R1 I don't seem to create a MegaRoot-object.
My (simplified) code - the value of oEnv is correctly assigned to the one environment we have.
Dim oMegaApp As New MegaApplication Dim oEnv As MegaEnvironment Dim iRepos As MegaDatabase Dim oMegaRoot As MegaRoot oEnv.CurrentAdministrator = <user> oEnv.CurrentPassword = <passwd> for each iRepos in oEnv.Databases OpenMode = iRepos.GetProp("RO") oMegaRoot = iRepos.Open ... some code to download the data next
When I perform the command oMegaRoot = iRepos.Open, the object oMegaRoot is left unassigned as 'nothing' instead of an open connection to the repository that I would like to download the data from.
Can anybody shine his/her light on this matter and tell me what I might to wrong or what might have changed since I used my code in MEGA 2009?
Tnx,
Jeroen.
Solved! Go to Solution.
‎10-01-2019 09:36 AM
I'm being advised to use OpenEx instead of Open:
Par exemple :
Set mgRoot = mgBase.openEx("Login=" + login + ";Profile=" + profile + ";OpenMode=R;TranType=Micro")
‎09-01-2019 09:40 AM
Imran, thanks for your response, but it doesn't help me. In your code you mention 1 extra line of code: Set oEnv = oMegaApp.Environments(1) Since oEnv is already correctly assigned that is not the problem. I can also get a list of all the repositories/databases that are available in the environment. But when I want to open a MEGAROOT (iRepos.Open) of each database, the value of oMegaRoot is left unassigned (IsNothing).
So anybody else?
‎27-12-2018 02:57 PM
Dim oMegaApp As New MegaApplication
Dim oEnv As MegaEnvironment
Dim iRepos As MegaDatabase
Dim oMegaRoot As MegaRoot
Set oEnv = oMegaApp.Environments(1)
oEnv.CurrentAdministrator = ""
oEnv.CurrentPassword = ""
For Each iRepos In oEnv.Databases
OpenMode = iRepos.GetProp("RO")
Set oMegaRoot = iRepos.Open
Next
End Sub
‎27-12-2018 02:56 PM
Seem to work fine for me with MSWord VB Studio