home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form logon
- BackColor = &H00C0FFC0&
- Caption = "Logon For SQL Server 4.2x"
- ClientHeight = 1665
- ClientLeft = 1665
- ClientTop = 3285
- ClientWidth = 5580
- ControlBox = 0 'False
- Height = 2070
- Left = 1605
- LinkTopic = "Form2"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1665
- ScaleWidth = 5580
- Top = 2940
- Width = 5700
- Begin CommandButton cancelbut
- Cancel = -1 'True
- Caption = "Cancel"
- Height = 615
- Left = 3600
- TabIndex = 9
- Top = 840
- Width = 1695
- End
- Begin CommandButton logonbut
- Caption = "Logon to Server"
- Default = -1 'True
- Height = 615
- Left = 3600
- TabIndex = 8
- Top = 120
- Width = 1695
- End
- Begin TextBox dbase
- Height = 285
- Left = 1440
- TabIndex = 7
- Text = "pubs"
- Top = 1200
- Width = 1935
- End
- Begin TextBox serverid
- Height = 285
- Left = 1440
- TabIndex = 6
- Text = "42NT"
- Top = 840
- Width = 1935
- End
- Begin TextBox password
- Height = 285
- Left = 1440
- TabIndex = 5
- Top = 480
- Width = 1935
- End
- Begin TextBox uid
- Height = 285
- Left = 1440
- TabIndex = 4
- Text = "sa"
- Top = 120
- Width = 1935
- End
- Begin Label Label4
- Alignment = 1 'Right Justify
- Caption = "DataBase :"
- Height = 195
- Left = 200
- TabIndex = 3
- Top = 1200
- Width = 1000
- End
- Begin Label Label3
- Alignment = 1 'Right Justify
- Caption = "Server Id :"
- Height = 195
- Left = 200
- TabIndex = 2
- Top = 840
- Width = 1000
- End
- Begin Label Label2
- Alignment = 1 'Right Justify
- Caption = "PassWord :"
- Height = 195
- Left = 200
- TabIndex = 1
- Top = 480
- Width = 1000
- End
- Begin Label Label1
- Alignment = 1 'Right Justify
- Caption = "User Id :"
- Height = 195
- Left = 200
- TabIndex = 0
- Top = 120
- Width = 1000
- End
- Sub cancelbut_Click ()
- ' User does not wish to connect
- Unload Me
- End Sub
- Sub logonbut_Click ()
- ' If the application has not already initialized the
- ' DB-Library then use the SqlInit function to init
- ' the DB-Library
- If dblib = "" Then
- dblib = SqlInit()
- End If
- ' This form solicits from the user the following
- ' information
- ' Userid
- ' Password
- ' Database to be used - this should be either pubs
- ' or pubs2 for this application
- ' to function property
- usid = uid.Text
- If usid = "" Then
- MsgBox "You must enter a userid"
- Exit Sub
- End If
- pword = password.Text
- sid = serverid.Text
- If sid = "" Then
- MsgBox "You must enter the server name"
- Exit Sub
- End If
- datbase = dbase.Text
- If datbase = "" Then
- MsgBox "You must enter the database name - pubs for SqlServer 4.2 or pubs2 for System 10"
- Exit Sub
- End If
- If datbase <> "pubs" Then
- MsgBox "Your database name should be - pubs for SqlServer 4.2"
- End If
- ' Once the information needed to open a connection is
- ' obtained from the user open a connection with the server
- ' using the SqlOpenConnection function. This function
- ' returns a connection pointer if the connection is made.
- ' if no connection is made then the connection pointer will
- ' be zero (NULL)
- dbconn = SqlOpenConnection(sid, usid, pword, "", "SombreroApp1")
- ' If the connection is made the next thing we need to do
- ' is point to the correct database which has the data
- ' required for the application. In this case the data is
- ' in the authors table found in the pubs database for SQL
- ' Server 4.2 or in the pubs2 database for SYBASE System 10
- If dbconn <> 0 Then
- ret = SqlUse(dbconn, datbase)
- If ret <> 1 Then
- SqlClose (dbconn)
- dbconn = 0
- End If
- Else
- Exit Sub
- End If
- ' If the connection has been made and the database changed
- ' to pubs/pubs2 then hiding the connect button will allow
- ' the application to run
- If ret = 1 Then
- mainform!multibut.Visible = False
- Unload Me
- End If
- End Sub
-