Repository.ConnectToRepository: Difference between revisions
Jump to navigation
Jump to search
Alex Ulanov (talk | contribs) (→Syntax) |
Alex Ulanov (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
If the extension of the file is *.rserp, then it connects to the enterprise database described in the file. Otherwise MS Access repository is assumed. | If the extension of the file is *.rserp, then it connects to the enterprise database described in the file. Otherwise MS Access repository is assumed. | ||
== Syntax == | == Syntax == | ||
*ConnectToRepository( FileName {{APIPrefix|As String}} ){{APIPrefix|As Boolean}} | *ConnectToRepository( FileName {{APIPrefix|As String}} ){{APIPrefix|As Boolean}} | ||
Line 10: | Line 9: | ||
Parameters | Parameters | ||
:''FileName'': The path to the Synthesis Repository you will connect to. | :''FileName'': The path to the Synthesis Repository you will connect to. | ||
{{Template:BooleanReturn.Cmt}} | |||
== Usage Example == | == Usage Example == | ||
{{Template:RepositoryFull.Ex}} | {{Template:RepositoryFull.Ex}} |
Revision as of 17:09, 20 May 2015
Connects to any local repository (MS Access, MS SQL or Oracle).
If the extension of the file is *.rserp, then it connects to the enterprise database described in the file. Otherwise MS Access repository is assumed.
Syntax
- ConnectToRepository( FileName As String )As Boolean
Parameters
- FileName: The path to the Synthesis Repository you will connect to.
Returns True if successful, otherwise returns False.
Usage Example
In this usage example, the API is used to connect to a repository, retrieve one of the models in it and then calculate the reliability at a specified time, based on that model.
'Declare a new repository connection object. See Repository. Dim MyRepository As New Repository 'Connect to a Synthesis repository. Dim Success As Boolean = False Success = MyRepository.ConnectToRepository("C:\Users\Name\Documents\ReliaSoft\Files\repository.rsr10") 'Get a list of the names/IDs of projects in the connected repository. Dim ListOfProjects() As NameIdPair ListOfProjects = MyRepository.Project.GetAllProjects() 'Open the first project in the list. MyRepository.Project.SetCurrentProject(ListOfProjects(0).ID) 'Get a list of the names/IDs of models in the current project. Dim ListOfModels() As NameIdPair ListOfModels = MyRepository.Model.GetAllModelsInfo() 'Retrieve the first model in the list. Dim AModel As cModel AModel = MyRepository.Model.GetModel(ListOfModels(0).ID) 'Calculate the reliability at time = 50 and save the result. See Reliability. Dim Rel As Double Rel = AModel.Reliability(50) 'Disconnect from the repository. MyRepository.DisconnectFromRepository()