Siebel Object Interfaces Reference > Programming > Getting Started with the Siebel Object Interfaces >

Instantiating the Siebel COM Data Control


To use Siebel Interface methods with the Siebel COM Data Control, use the object browser of your Siebel COM Data Control programming tool to determine the correct method syntax.

To set up Microsoft Visual Basic to access the Siebel COM Data Control Interface

  1. Be sure you have installed the Siebel COM Data Control. Read Installing Siebel Object Interfaces.
  2. Start Microsoft Visual Basic.
  3. Select Standard EXE.
  4. Choose Project > References.
  5. In the list box, highlight (but do not check) Siebel BusObject Interfaces Type Library. Near the bottom of the dialog box, note the directory in which the file sstchca.dll resides, as shown in the following illustration.
  6. Open the Object Browser to verify that you can see the Siebel objects.

To instantiate and use the Siebel COM Data Control, you must use the CreateObject and Login methods. You cannot use methods that retrieve active Siebel objects, because there are no current active Siebel objects. You must instantiate your own Siebel objects. Calls made to the Siebel COM Data Control are also in-process.

The following is sample code for the Siebel COM Data Control:

Sub CreateDataControl()
Dim errCode As Integer
Set SiebelApplication = CreateObject("SiebelDataControl.SiebelDataControl.1")
SiebelApplication.Login "host=""siebel://hostname/EnterpriseServer/AppObjMgr""", "CCONWAY", "CCONWAY"
errCode = SiebelApplication.GetLastErrCode()
If errCode <> 0 Then
   ErrText = SiebelApplication.GetLastErrText
   TheApplication().RaiseErrorText(ErrText);
   Exit Sub
End If
set OpptyB0 = SiebelApplication.GetBusObject("Opportunity",errCode)
set OpptyBC = OpptyBO.GetBusComp("Opportunity", errCode)
End Sub

See Table 19 for values to substitute for the placeholders in the login string.

The following sample code instantiates the COM Data Control from a server-side ASP script.

NOTE:  The symbols <% and %> are used within HTML script to set off an ASP script.

<%

   Dim SiebelApplication, BO, BC, ConnStr, logstat
   Dim strLastName, strFirstName, errCode, errText

      Set SiebelApplication = CreateObject("SiebelDataControl.SiebelDataControl.1")

   ' Test to see if object is created
   If IsObject(SiebelApplication) = False then
      Response.Write "Unable to initiate Siebel Session.
   Else
      connStr = "host=" & Chr(34) & "siebel.tcpip.none.none://hostname:2321/EntServer/ObjMgr" & Chr(34) & " lang=" & Chr(34) & "<lang>" & Chr(34)
      logstat = SiebelApplication.Login ConnStr, "SADMIN", "SADMIN"

      response.write("Login Status: " & logstat)
      Set BO = SiebelApplication.GetBusObject("Employee")
      Set BC = BO.GetBusComp("Employee")
   End If

%>

For more information on instantiating the Siebel COM Data Control, read Connect String.

Siebel Object Interfaces Reference