ISCSession Interface
The following table contains information on the ISCSession interface:
| 
                                                                 Signature  | 
                                                            
                                                                 Description  | 
                                                            
                                                                 Valid Arguments  | 
                                                        
|---|---|---|
| 
                                                                 VARIANT_BOOL Open(IUnknown * Unit, VARIANT Level [optional], VARIANT Flags [optional])  | 
                                                            
                                                                 Binds self to the persistence unit identified by the Unit parameter  | 
                                                            
                                                                 Unit: 
 Level: 
 Flags: 
  | 
                                                        
Example 6
The following example illustrates how to open a session using C++. The example uses the Application object created in Example 1 and the CreateNewModel function from Example 4:
ISCSessionPtr OpenSession(ISCApplicationPtr & scAppPtr)
{     
      ISCSessionCollectionPtr scSessionColPtr = scAppPtr->GetSessions();
      ISCSessionPtr scSessionPtr = scSessionColPtr->Add();  // add a new session
      ISCPersistenceUnitPtr scPUnitPtr = CreateNewModel(scAppPtr); // From Example 4
      
      CComVariant varResult = scSessionPtr->Open(scPUnitPtr, (long) SCD_SL_M0); // open unit
      if (varResult.vt == VT_BOOL && varResult.boolVal == FALSE)
         return NULL;
      return scSessionPtr;
}
                                                    The following example illustrates how to open a session using Visual Basic .NET. The example uses the Application object created in Example 1 and the CreateNewModel function from Example 4:
Public Function OpenSession(ByRef scApp As SCAPI.Application) As SCAPI.Session
      Dim scSessionCol As SCAPI.Sessions
      Dim scPUnit As SCAPI.PersistenceUnit
      scSessionCol = scApp.Sessions
      OpenSession = scSessionCol.Add  'new session
   
      scPUnit = CreateNewModel(scApp)  ' From Example 4
      scSession.Open(scPUnit, SCD_SL_M0)  ' open the persistence unit
End Sub
                                                    
| 
                                                             
 Copyright © 2025 Quest Software, Inc.  |