_Leveraging Oracle Power Objects 2.1_
by Douglas C. McArthur

Listing One
'Sub Click()
' Connect to database using proper connection string syntax
' for ODBC or ORACLE connection as specified in the popup
' list "popConnectionType" with radio buttons for "ODBC" and
' "ORACLE" values, and using values from fields "fldLogin",
' "fldPassword", and "fldDatabase" on user click.

DIM vConnectString as String

SELECT CASE popConnectionType.Value
  CASE "ODBC"
    vConnectString = "odbc:UID=" & fldLogin.Value &      &
                     ";PWD="     & fldPassword.Value &   &
                     ";DB="      & fldDatabase.Value
  CASE "ORACLE"
    vConnectString = "oracle:" & fldLogin.Value &        &
                     "/"       & fldPassword.Value &     &
                     IIF( ISNULL( fldDatabase.Value ),   &
                          "", "@" & fldDatabase.Value    &
                        )
END SELECT
 
sesDatabase.RunConnect = vConnectString
sesDatabase.Connect()

IF sesDatabase.IsConnected() THEN
    frmMainMenu.OpenWindow()
ELSE
   MsgBox( "Unable to connect to database.  " &  &
           "Check login name, password, and database name." )
END IF

'End Sub Click()


Listing Two
'Function udmFindString( pRecordset, pColumnName, pString ) as Integer
' Loop through each row in pRecordSet, checking if
' pColumnName is equal to pString.  Return the row
' if a match is found, or a zero when no match.
' ====================================================================

FOR vRow = 1 TO pRecordset.GetRowCount()
  pRecordset.SetCurRow( vRow )
  IF pRecordset.GetColVal( pColumnName ) = pString THEN
     FindString =3D vRow
     EXIT FUNCTION
  END IF
NEXT
FindString = 0
'End Function udmFindString()


Listing Three
'Sub udmResizeToContainer()
' Set SizeX of field's class container and field itself to the number
' of pixels from class's PositionX and its container's SizeX.  
' ======================================================================
Container.SizeX = Container.GetContainer().SizeX - Container.PositionX

Self.SizeX = Container.SizeX
'End Sub udmResizeToContainer()





