VERSION 4.00
Begin VB.Form fconnect 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Server Connect"
   ClientHeight    =   2160
   ClientLeft      =   2280
   ClientTop       =   3990
   ClientWidth     =   4515
   Height          =   2565
   Left            =   2220
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2160
   ScaleWidth      =   4515
   Top             =   3645
   Width           =   4635
   Begin VB.TextBox MyPassword 
      Height          =   315
      Left            =   1380
      TabIndex        =   5
      Top             =   930
      Width           =   2655
   End
   Begin VB.TextBox MyLogin 
      Height          =   315
      Left            =   1380
      TabIndex        =   4
      Top             =   600
      Width           =   2655
   End
   Begin VB.TextBox MyServer 
      Height          =   315
      Left            =   1380
      TabIndex        =   3
      Top             =   270
      Width           =   2655
   End
   Begin Threed.SSCommand Command1 
      Height          =   375
      Left            =   2190
      TabIndex        =   6
      Top             =   1620
      Width           =   1500
      _version        =   65536
      _extentx        =   2646
      _extenty        =   661
      _stockprops     =   78
      caption         =   "&Cancel"
      bevelwidth      =   1
      outline         =   0   'False
   End
   Begin Threed.SSCommand Connect 
      Default         =   -1  'True
      Height          =   375
      Left            =   540
      TabIndex        =   7
      Top             =   1620
      Width           =   1500
      _version        =   65536
      _extentx        =   2646
      _extenty        =   661
      _stockprops     =   78
      caption         =   "&Connect"
      bevelwidth      =   1
      outline         =   0   'False
   End
   Begin VB.Label Label1 
      BackColor       =   &H00C0C0C0&
      Caption         =   "Password:"
      Height          =   255
      Index           =   2
      Left            =   210
      TabIndex        =   2
      Top             =   960
      Width           =   795
   End
   Begin VB.Label Label1 
      BackColor       =   &H00C0C0C0&
      Caption         =   "Login:"
      Height          =   255
      Index           =   1
      Left            =   210
      TabIndex        =   1
      Top             =   630
      Width           =   795
   End
   Begin VB.Label Label1 
      BackColor       =   &H00C0C0C0&
      Caption         =   "Server:"
      Height          =   255
      Index           =   0
      Left            =   210
      TabIndex        =   0
      Top             =   270
      Width           =   795
   End
End
Attribute VB_Name = "fconnect"
Attribute VB_Creatable = False
Attribute VB_Exposed = False

Private Sub Command1_Click()
    Unload fconnect
    
End Sub

Private Sub Connect_Click()

 ' connect to the specified server/ login/ password
    ' check for valid parameters
    If MyServer.Text = "" Then
        MsgBox "Enter a valid server name, login ID and password. Then press Connect.", 64, "Microsoft SQL Server"
        Exit Sub
    End If
    MousePointer = 11   ' hourglass cursor
    SQLPDBA.StatusBar.Caption = "Connecting to \\" + MyServer.Text
   
    On Error Resume Next
    
    ' connect to the server
    OServer.Connect ServerName:=MyServer.Text, _
                        Login:=MyLogin.Text, _
                        Password:=MyPassword.Text
    
    If Err <> 0 Then    ' errors?
          MsgBox Err.Description + " (Press F1 for Help)", 16, Err.Source & " Error", _
          Err.HelpFile, Err.HelpContext
          MousePointer = 0
          Exit Sub
    End If
    MousePointer = 11
    On Error GoTo 0
    SQLConnected = True
    SQLPDBA.StatusBar.Caption = "Connected to \\" + OServer.Name
    SQLPDBA.SetConnectButtons
    SQLPDBA.bDB.Enabled = True
    SQLPDBA.bDevice.Enabled = True
    SQLPDBA.bConnect.Enabled = False

    Unload fconnect     ' all done

End Sub

