home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / po7_win / object10 / objlogin.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-10-29  |  4.6 KB  |  154 lines

  1. VERSION 2.00
  2. Begin Form frmObjLogin 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Oracle Login"
  5.    ClientHeight    =   2790
  6.    ClientLeft      =   2235
  7.    ClientTop       =   2970
  8.    ClientWidth     =   4050
  9.    Height          =   3195
  10.    Left            =   2175
  11.    LinkTopic       =   "Form4"
  12.    ScaleHeight     =   2790
  13.    ScaleWidth      =   4050
  14.    Top             =   2625
  15.    Width           =   4170
  16.    Begin TextBox txtODBCDatabaseName 
  17.       Height          =   285
  18.       Left            =   1680
  19.       TabIndex        =   3
  20.       Text            =   "ODBCExampleDb"
  21.       Top             =   1680
  22.       Width           =   2295
  23.    End
  24.    Begin CommandButton cmdCancel 
  25.       Caption         =   "Cancel"
  26.       Height          =   495
  27.       Left            =   2280
  28.       TabIndex        =   5
  29.       Top             =   2160
  30.       Width           =   1215
  31.    End
  32.    Begin CommandButton cmdOK 
  33.       Caption         =   "OK"
  34.       Default         =   -1  'True
  35.       Height          =   495
  36.       Left            =   480
  37.       TabIndex        =   4
  38.       Top             =   2160
  39.       Width           =   1215
  40.    End
  41.    Begin TextBox txtDatabaseName 
  42.       Height          =   285
  43.       Left            =   1680
  44.       TabIndex        =   2
  45.       Text            =   "ExampleDb"
  46.       Top             =   1200
  47.       Width           =   2295
  48.    End
  49.    Begin TextBox txtPassword 
  50.       Height          =   285
  51.       Left            =   1680
  52.       PasswordChar    =   "*"
  53.       TabIndex        =   1
  54.       Text            =   "tiger"
  55.       Top             =   720
  56.       Width           =   2295
  57.    End
  58.    Begin TextBox txtUserName 
  59.       Height          =   285
  60.       Left            =   1680
  61.       TabIndex        =   0
  62.       Text            =   "Scott"
  63.       Top             =   240
  64.       Width           =   2295
  65.    End
  66.    Begin Label Label4 
  67.       Alignment       =   1  'Right Justify
  68.       AutoSize        =   -1  'True
  69.       Caption         =   "ODBC Database:"
  70.       Height          =   195
  71.       Left            =   120
  72.       TabIndex        =   9
  73.       Top             =   1680
  74.       Width           =   1455
  75.    End
  76.    Begin Label Label3 
  77.       Alignment       =   1  'Right Justify
  78.       AutoSize        =   -1  'True
  79.       Caption         =   "Database:"
  80.       Height          =   195
  81.       Left            =   660
  82.       TabIndex        =   8
  83.       Top             =   1200
  84.       Width           =   885
  85.    End
  86.    Begin Label Label2 
  87.       Alignment       =   1  'Right Justify
  88.       AutoSize        =   -1  'True
  89.       Caption         =   "Password:"
  90.       Height          =   195
  91.       Left            =   720
  92.       TabIndex        =   7
  93.       Top             =   720
  94.       Width           =   885
  95.    End
  96.    Begin Label Label1 
  97.       Alignment       =   1  'Right Justify
  98.       AutoSize        =   -1  'True
  99.       Caption         =   "User Name:"
  100.       Height          =   195
  101.       Left            =   600
  102.       TabIndex        =   6
  103.       Top             =   240
  104.       Width           =   1005
  105.    End
  106. Option Explicit
  107. Sub cmdCancel_Click ()
  108.  Unload frmObjLogin
  109. End Sub
  110. Sub cmdOK_Click ()
  111.  If txtUserName.Text <> "" Then
  112.   UserName$ = txtUserName.Text
  113.   Password$ = txtPassword.Text
  114.   DatabaseName$ = txtDatabaseName.Text
  115.   ODBCDatabaseName$ = txtODBCDatabaseName.Text
  116.   Connect$ = UserName$ + "/" + Password$
  117.   ODBCConnect$ = "ODBC;DSN=" & ODBCDatabaseName$ & ";UID=" & UserName$ & ";PWD=" & Password$ & ";"
  118.   On Error GoTo NoOraConnection
  119.   Set OraSession = Nothing
  120.   Set OraSession = CreateObject("OracleInProcServer.XOraSession")
  121.   Set OraDatabase = Nothing
  122.   Set OraDatabase = OraSession.OpenDatabase(DatabaseName$, Connect$, 0&)
  123.   On Error GoTo NoODBCConnection
  124.   Set MSDatabase = Nothing
  125.   Set MSDatabase = OpenDatabase("", False, False, ODBCConnect$)
  126.   OraSession.LastServerErrReset
  127.   frmObjLogin.Hide
  128.   frmObjTest.Show
  129.  End If
  130. Exit Sub
  131. NoOraConnection:
  132.  frmObjOraError.Show MODAL
  133. NoODBCConnection:
  134. End Sub
  135. Sub Form_Load ()
  136.  Call CenterForm(frmObjLogin)
  137. End Sub
  138. Sub txtDatabaseName_GotFocus ()
  139.  txtDatabaseName.SelStart = 0
  140.  txtDatabaseName.SelLength = Len(txtDatabaseName.Text)
  141. End Sub
  142. Sub txtODBCDatabaseName_GotFocus ()
  143.  txtODBCDatabaseName.SelStart = 0
  144.  txtODBCDatabaseName.SelLength = Len(txtODBCDatabaseName.Text)
  145. End Sub
  146. Sub txtPassword_GotFocus ()
  147.  txtPassword.SelStart = 0
  148.  txtPassword.SelLength = Len(txtPassword.Text)
  149. End Sub
  150. Sub txtUsername_GotFocus ()
  151.  txtUserName.SelStart = 0
  152.  txtUserName.SelLength = Len(txtUserName.Text)
  153. End Sub
  154.