home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Internet Business Development Kit / PRODUCT_CD.iso / sqlsvr / ppc / fconnect.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-10-02  |  4.2 KB  |  135 lines

  1. VERSION 4.00
  2. Begin VB.Form fconnect 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Server Connect"
  6.    ClientHeight    =   2160
  7.    ClientLeft      =   2280
  8.    ClientTop       =   3990
  9.    ClientWidth     =   4515
  10.    Height          =   2565
  11.    Left            =   2220
  12.    LinkTopic       =   "Form2"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   2160
  16.    ScaleWidth      =   4515
  17.    Top             =   3645
  18.    Width           =   4635
  19.    Begin VB.TextBox MyPassword 
  20.       Height          =   315
  21.       Left            =   1380
  22.       TabIndex        =   5
  23.       Top             =   930
  24.       Width           =   2655
  25.    End
  26.    Begin VB.TextBox MyLogin 
  27.       Height          =   315
  28.       Left            =   1380
  29.       TabIndex        =   4
  30.       Top             =   600
  31.       Width           =   2655
  32.    End
  33.    Begin VB.TextBox MyServer 
  34.       Height          =   315
  35.       Left            =   1380
  36.       TabIndex        =   3
  37.       Top             =   270
  38.       Width           =   2655
  39.    End
  40.    Begin Threed.SSCommand Command1 
  41.       Height          =   375
  42.       Left            =   2190
  43.       TabIndex        =   6
  44.       Top             =   1620
  45.       Width           =   1500
  46.       _version        =   65536
  47.       _extentx        =   2646
  48.       _extenty        =   661
  49.       _stockprops     =   78
  50.       caption         =   "&Cancel"
  51.       bevelwidth      =   1
  52.       outline         =   0   'False
  53.    End
  54.    Begin Threed.SSCommand Connect 
  55.       Default         =   -1  'True
  56.       Height          =   375
  57.       Left            =   540
  58.       TabIndex        =   7
  59.       Top             =   1620
  60.       Width           =   1500
  61.       _version        =   65536
  62.       _extentx        =   2646
  63.       _extenty        =   661
  64.       _stockprops     =   78
  65.       caption         =   "&Connect"
  66.       bevelwidth      =   1
  67.       outline         =   0   'False
  68.    End
  69.    Begin VB.Label Label1 
  70.       BackColor       =   &H00C0C0C0&
  71.       Caption         =   "Password:"
  72.       Height          =   255
  73.       Index           =   2
  74.       Left            =   210
  75.       TabIndex        =   2
  76.       Top             =   960
  77.       Width           =   795
  78.    End
  79.    Begin VB.Label Label1 
  80.       BackColor       =   &H00C0C0C0&
  81.       Caption         =   "Login:"
  82.       Height          =   255
  83.       Index           =   1
  84.       Left            =   210
  85.       TabIndex        =   1
  86.       Top             =   630
  87.       Width           =   795
  88.    End
  89.    Begin VB.Label Label1 
  90.       BackColor       =   &H00C0C0C0&
  91.       Caption         =   "Server:"
  92.       Height          =   255
  93.       Index           =   0
  94.       Left            =   210
  95.       TabIndex        =   0
  96.       Top             =   270
  97.       Width           =   795
  98.    End
  99. Attribute VB_Name = "fconnect"
  100. Attribute VB_Creatable = False
  101. Attribute VB_Exposed = False
  102. Private Sub Command1_Click()
  103.     Unload fconnect
  104. End Sub
  105. Private Sub Connect_Click()
  106.  ' connect to the specified server/ login/ password
  107.     ' check for valid parameters
  108.     If MyServer.Text = "" Then
  109.         MsgBox "Enter a valid server name, login ID and password. Then press Connect.", 64, "Microsoft SQL Server"
  110.         Exit Sub
  111.     End If
  112.     MousePointer = 11   ' hourglass cursor
  113.     SQLPDBA.StatusBar.Caption = "Connecting to \\" + MyServer.Text
  114.     On Error Resume Next
  115.     ' connect to the server
  116.     OServer.Connect ServerName:=MyServer.Text, _
  117.                         Login:=MyLogin.Text, _
  118.                         Password:=MyPassword.Text
  119.     If Err <> 0 Then    ' errors?
  120.           MsgBox Err.Description + " (Press F1 for Help)", 16, Err.Source & " Error", _
  121.           Err.HelpFile, Err.HelpContext
  122.           MousePointer = 0
  123.           Exit Sub
  124.     End If
  125.     MousePointer = 11
  126.     On Error GoTo 0
  127.     SQLConnected = True
  128.     SQLPDBA.StatusBar.Caption = "Connected to \\" + OServer.Name
  129.     SQLPDBA.SetConnectButtons
  130.     SQLPDBA.bDB.Enabled = True
  131.     SQLPDBA.bDevice.Enabled = True
  132.     SQLPDBA.bConnect.Enabled = False
  133.     Unload fconnect     ' all done
  134. End Sub
  135.