LzmTW.uSystem.uData.uSql

Author:水如烟    

Namespace  LzmTW.uSystem.uData.uSql

    
< Serializable() >  _
    
Public   Class  LoginInformation
        
Private  gServerName  As   String   =   " ./SQLExpress "
        
Private  gDatabase  As   String
        
Private  gUserName  As   String
        
Private  gPassword  As   String
        
Private  gUseSSPI  As   Boolean   =   True

        
< NonSerialized() >   Private  gSqlVersion  As   String   =   Nothing
        
< NonSerialized() >   Private  SQL_CONNECTIONSTRING  As   String   =   " Data Source={0};Initial Catalog={1}; "
        
< NonSerialized() >   Private  SSPI_STRING  As   String   =   " Integrated Security=True; "
        
< NonSerialized() >   Private  NOT_SSPI_STRING  As   String   =   " Persist Security Info=True;User ID={0};Password={1}; "

        
Public   Property  ServerName()  As   String
            
Get
                
Return  gServerName
            
End   Get
            
Set ( ByVal  value  As   String )
                gServerName 
=  value
            
End   Set
        
End Property

        
Public   Property  Database()  As   String
            
Get
                
Return  gDatabase
            
End   Get
            
Set ( ByVal  value  As   String )
                gDatabase 
=  value
            
End   Set
        
End Property

        
Public   Property  UserName()  As   String
            
Get
                
Return  gUserName
            
End   Get
            
Set ( ByVal  value  As   String )
                gUserName 
=  value
            
End   Set
        
End Property

        
Public   Property  Password()  As   String
            
Get
                
Return  gPassword
            
End   Get
            
Set ( ByVal  value  As   String )
                gPassword 
=  value
            
End   Set
        
End Property

        
Public   Property  UseSSPI()  As   Boolean
            
Get
                
Return  gUseSSPI
            
End   Get
            
Set ( ByVal  value  As   Boolean )
                gUseSSPI 
=  value
            
End   Set
        
End Property

        
Public   Function  TestConnect()  As   Boolean
            
Dim  mResult  As   Boolean   =   False

            
Dim  mConnection  As   New  SqlClient.SqlConnection( Me .ConnectionStringBuilder.ConnectionString)

            
Try
                mConnection.Open()

                
Me .gSqlVersion  =   Me .GetSqlVersion(mConnection)
                mResult 
=   True

                mConnection.Close()
            
Catch  ex  As  Exception
            
End   Try

            mConnection.Dispose()

            
Return  mResult
        
End Function


        
Public   ReadOnly   Property  ConnectionStringBuilder()  As  SqlClient.SqlConnectionStringBuilder
            
Get

                
Return   New  SqlClient.SqlConnectionStringBuilder(GetConnnectionString)
            
End   Get
        
End Property

        
Public   ReadOnly   Property  SqlVersion()  As   String
            
Get
                
Return  gSqlVersion
            
End   Get
        
End Property

        
Private   Function  GetConnnectionString()  As   String
            
Dim  mConnectionString  As   String

            mConnectionString 
=   String .Format( Me .SQL_CONNECTIONSTRING,  Me .ServerName,  Me .Database)

            
If   Me .UseSSPI  Then
                mConnectionString 
=   String .Concat(mConnectionString,  Me .SSPI_STRING)
            
Else
                mConnectionString 
=   String .Concat(mConnectionString,  String .Format( Me .NOT_SSPI_STRING,  Me .UserName,  Me .Password))
            
End   If

            
Return  mConnectionString
        
End Function

        
' 取当前SQLServer版本
         Private   Function  GetSqlVersion( ByVal  connection  As  SqlClient.SqlConnection)  As   String
            
Dim  mResult  As   String   =   Nothing

            
Dim  mCommand  As   New  SqlClient.SqlCommand( " Master..xp_msver " , connection)
            
Dim  mDataReader  As  SqlClient.SqlDataReader

            
With  mCommand
                .CommandType 
=  CommandType.StoredProcedure

                mDataReader 
=  .ExecuteReader
                
With  mDataReader
                    
While  .Read()
                        
If  .Item( " Name " ).ToString  =   " ProductVersion "   Then

                            mResult 
=  .Item( " Character_Value " ).ToString
                            
Exit   While
                        
End   If
                    
End   While

                    .Close()
                
End   With

                .Dispose()
            
End   With

            
Return  mResult
        
End Function

        
' 取数据库列表
         Public   Function  GetDatabases()  As   String ()
            
Dim  tmpInformation  As   New  LoginInformation
            tmpInformation.CopyFrom(
Me )
            tmpInformation.Database 
=   " Master "

            
Dim  mResult( - 1 As   String

            
Dim  mConnection  As   New  SqlClient.SqlConnection(tmpInformation.ConnectionStringBuilder.ConnectionString)
            
Dim  mCommand  As   New  SqlClient.SqlCommand( " SELECT [name] FROM master.dbo.sysdatabases " , mConnection)
            
Dim  mDataReader  As  SqlClient.SqlDataReader

            
Try
                mConnection.Open()
                mDataReader 
=  mCommand.ExecuteReader(CommandBehavior.CloseConnection)
                
With  mDataReader
                    
While  .Read()
                        uSystem.uCollection.CommonFunction.Append(
Of   String )(mResult, .Item( " Name " ).ToString)
                    
End   While
                    .Close()
                
End   With

                mCommand.Dispose()
                mConnection.Dispose()
            
Catch  ex  As  Exception

            
End   Try

            
Return  mResult
        
End Function

        
Public   Sub  CopyFrom( ByVal  info  As  LoginInformation)
            
With  info
                
Me .ServerName  =  .ServerName
                
Me .Database  =  .Database
                
Me .UserName  =  .UserName
                
Me .Password  =  .Password
                
Me .UseSSPI  =  .UseSSPI
            
End   With
        
End Sub

        
Public   Sub  Read()
            
Dim  mFileName  As   String   =  LzmTW.EntryAssemblyInfo.GetApplicationUserPath  &   " LoginInformation.dat "
            
Dim  mLoginInformation  As  LoginInformation
            
If  IO.File.Exists(mFileName)  Then
                
Try
                    mLoginInformation 
=  uSystem.uRuntime.uSerialization.SerializeHelper.Load( Of  LoginInformation)(mFileName, uRuntime.uSerialization.FormatType.Binary)
                    
Me .CopyFrom(mLoginInformation)
                    mLoginInformation 
=   Nothing
                
Catch  ex  As  Exception
                    IO.File.Delete(mFileName)
                
End   Try
            
End   If
        
End Sub

        
Public   Sub  Save()
            
Dim  mFileName  As   String   =  LzmTW.EntryAssemblyInfo.GetApplicationUserPath  &   " LoginInformation.dat "
            uSystem.uRuntime.uSerialization.SerializeHelper.Save(
Of  LoginInformation)(mFileName, uRuntime.uSerialization.FormatType.Binary,  Me )
        
End Sub
    
End Class
End Namespace

 

Namespace  LzmTW.uSystem.uData.uSql

    
Public   Class  SqlLoginService

        
Private  gLoginInformation  As   New  LoginInformation

        
Public   ReadOnly   Property  LoginInformation()  As  LoginInformation
            
Get
                
Return  gLoginInformation
            
End   Get
        
End Property

        
Sub   New ()
            gLoginInformation.Read()
        
End Sub

        
Public   Function  TestConnect()  As   Boolean
            
Dim  mResult  As   Boolean
            mResult 
=  gLoginInformation.TestConnect()
            
If   Not  mResult  Then
                ResetLoginInformation()
                mResult 
=  gLoginInformation.TestConnect()
            
End   If

            
Return  mResult
        
End Function

        
Public   Sub  ResetLoginInformation()
            
Dim  f  As   New  SqlLoginForm
            f.ShowDialog(
Me )
        
End Sub
    
End Class

End Namespace

 

Namespace  LzmTW.uSystem.uData.uSql
    
Friend   Class  SqlLoginForm

        
Private  gService  As  SqlLoginService
        
Private  gServers( - 1 As   String
        
Private  gIsSavePass  As   Boolean
        
Private  gLoginWayArray  As   String ()  =   New   String () { " Windows 身份验证 " " SQL Server 身份验证 " }

        
Private   Sub  ComboBoxServer_SelectedIndexChanged( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)  Handles  ComboBoxServer.SelectedIndexChanged
            DoWhenInformationChanged()
        
End Sub

        
Private   Sub  TextBoxUser_TextChanged( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)  Handles  TextBoxUser.TextChanged, TextBoxPassword.TextChanged
            DoWhenInformationChanged()
        
End Sub

        
Private   Sub  ComboBoxAuthentication_SelectedIndexChanged( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)  Handles  ComboBoxAuthentication.SelectedIndexChanged
            
If   String .IsNullOrEmpty( Me .ComboBoxAuthentication.Text)  Then   Exit Sub

            
Dim  mIsSSPI  As   Boolean   =  ( Me .ComboBoxAuthentication.Text  =  gLoginWayArray( 0 ))
            UpdateUIWhenLoginWayChanged(mIsSSPI)

            DoWhenInformationChanged()
        
End Sub

        
Private   Sub  UpdateUIWhenLoginWayChanged( ByVal  isSSPI  As   Boolean )

            
Me .LabelUser.Enabled  =   Not  isSSPI

            
If  isSSPI  Then
                
Me .LabelUser.Text  =   " 用户名(&U): "
                
Me .TextBoxUser.Text  =  ( New  Microsoft.VisualBasic.ApplicationServices.User).Name
                
Me .TextBoxPassword.Text  =   ""
                
Me .CheckBoxRemember.Checked  =   False
            
Else
                
Me .LabelUser.Text  =   " 登录名(&L): "
                
Me .TextBoxUser.Text  =  gService.LoginInformation.UserName
                
Me .TextBoxPassword.Text  =  gService.LoginInformation.Password
                
Me .CheckBoxRemember.Checked  =   Me .gIsSavePass
            
End   If

            
Me .TextBoxUser.Enabled  =   Not  isSSPI
            
Me .LabelPassword.Enabled  =   Not  isSSPI
            
Me .TextBoxPassword.Enabled  =   Not  isSSPI
            
Me .CheckBoxRemember.Enabled  =   Not  isSSPI

        
End Sub

        
Public   Overloads   Function  ShowDialog( ByVal  service  As  SqlLoginService)  As  DialogResult
            gService 
=  service
            LzmTW.uSystem.uThreading.CrossThread.UpdateControlByCurrentClassThreadAction(
Me AddressOf  UIInitialize)
            
Return   MyBase .ShowDialog()
        
End Function


        
Private   Sub  UIInitialize()
            
Me .Cursor  =  Cursors.WaitCursor
            
Me .ComboBoxServer.Enabled  =   False
            
Me .SendMessage( " 稍等,正在获取服务器列表... " )

            
For   Each  row  As  DataRow  In  Sql.SqlDataSourceEnumerator.Instance.GetDataSources.Rows
                uSystem.uCollection.CommonFunction.Append(
Of   String )(gServers, row( 0 ).ToString)
            
Next

            
Me .ComboBoxServer.DataSource  =  gServers
            
Me .ComboBoxServer.Enabled  =   True
            
Me .SendMessage()

            
Me .ComboBoxAuthentication.DataSource  =  gLoginWayArray
            
With  gService.LoginInformation

                
If   Not   String .IsNullOrEmpty(.ServerName)  AndAlso  Array.IndexOf(gServers, .ServerName)  =   - 1   Then
                    uSystem.uCollection.CommonFunction.Append(
Of   String )(gServers, .ServerName)
                    
Me .ComboBoxServer.DataSource  =  gServers
                
End   If

                
Me .ComboBoxServer.Text  =  .ServerName
                
Me .ComboBoxAuthentication.Text  =   CStr ( IIf (.UseSSPI, gLoginWayArray( 0 ), gLoginWayArray( 1 )))


                
Me .UpdateUIWhenLoginWayChanged(.UseSSPI)

                
If   Not  .UseSSPI  Then
                    
Me .gIsSavePass  =   Not   String .IsNullOrEmpty(.Password)
                
End   If

                
Me .CheckBoxRemember.Checked  =   Me .gIsSavePass

                
' GetDatabases()
                 Me .ComboBoxDatabase.Text  =  .Database

                
Me .Cursor  =  Cursors.Default
            
End   With

        
End Sub

        
Private   Sub  ButtonConnect_Click( ByVal  sender  As  System.Object,  ByVal  e  As  System.EventArgs)  Handles  ButtonConnect.Click
            
Dim  tmpInformation  As  LoginInformation  =   Me .GetCurrentInformation
            
Me .Cursor  =  Cursors.WaitCursor
            
Me .SendMessage( " 稍等,正在尝试连接数库... " )

            
If   Not  tmpInformation.TestConnect  Then
                
Me .SendMessage( " 连接失败 " )
            
Else
                
Me .SendMessage( " 连接成功 " )
            
End   If

            
Me .Cursor  =  Cursors.Default
        
End Sub


        
Private   Sub  ButtonDatabase_Click( ByVal  sender  As  System.Object,  ByVal  e  As  System.EventArgs)  Handles  ButtonDatabase.Click
            GetDatabases()
        
End Sub

        
Private   Sub  GetDatabases()
            
Dim  tmpInformation  As  LoginInformation  =   Me .GetCurrentInformation
            
Me .Cursor  =  Cursors.WaitCursor
            
Me .SendMessage( " 稍等,正在获取服务器列表... " )

            
Dim  mDatabaseArray()  As   String   =  tmpInformation.GetDatabases

            
If  mDatabaseArray.Length  =   0   Then
                
Me .SendMessage( " 连接失败 " )
            
Else
                
Me .SendMessage()
                
Me .ComboBoxDatabase.DataSource  =  mDatabaseArray
                
If  Array.IndexOf(mDatabaseArray,  Me .gService.LoginInformation.Database)  <>   - 1   Then
                    
Me .ComboBoxDatabase.Text  =   Me .gService.LoginInformation.Database
                
End   If
            
End   If

            
Me .Cursor  =  Cursors.Default
        
End Sub

        
Private   Sub  DoWhenInformationChanged()
            
Me .ComboBoxDatabase.DataSource  =   Nothing
            
Me .ComboBoxDatabase.Text  =   Me .gService.LoginInformation.Database
        
End Sub

        
Private   Function  GetCurrentInformation()  As  LoginInformation
            
Dim  tmpInformation  As   New  LoginInformation
            
With  tmpInformation
                .ServerName 
=   Me .ComboBoxServer.Text
                .Database 
=   Me .ComboBoxDatabase.Text
                .UseSSPI 
=  ( Me .ComboBoxAuthentication.Text  =  gLoginWayArray( 0 ))
                .UserName 
=   Me .TextBoxUser.Text
                .Password 
=   Me .TextBoxPassword.Text
            
End   With
            
Return  tmpInformation
        
End Function

        
Private   Sub  SendMessage( ByVal  s  As   String )
            
Me .LabelMessage.Text  =   String .Format( " 消息:{0} " , s)
            
Me .Refresh()
        
End Sub

        
Private   Sub  SendMessage()
            
Me .SendMessage( "" )
        
End Sub

 
        
Private   Sub  ButtonOK_Click( ByVal  sender  As  System.Object,  ByVal  e  As  System.EventArgs)  Handles  ButtonOK.Click
            
Dim  tmpInformation  As  LoginInformation  =   Me .GetCurrentInformation
            
Me .gService.LoginInformation.CopyFrom(tmpInformation)

            
With  tmpInformation
                
If  .UseSSPI  Then
                    .UserName 
=   ""
                    .Password 
=   ""
                
Else
                    
If   Not   Me .CheckBoxRemember.Checked  Then
                        .Password 
=   ""
                    
End   If
                
End   If

                .Save()
            
End   With

        
End Sub


    
End Class
End Namespace

 

Namespace  LzmTW.uSystem.uData.uSql
    
< Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated() >  _
    
Partial   Class  SqlLoginForm
        
Inherits  System.Windows.Forms.Form

        
' Form 重写 Dispose,以清理组件列表。
         < System.Diagnostics.DebuggerNonUserCode() >  _
        
Protected   Overrides   Sub  Dispose( ByVal  disposing  As   Boolean )
            
If  disposing  AndAlso  components  IsNot   Nothing   Then
                components.Dispose()
            
End   If
            
MyBase .Dispose(disposing)
        
End Sub

        
' Windows 窗体设计器所必需的
         Private  components  As  System.ComponentModel.IContainer

        
' 注意: 以下过程是 Windows 窗体设计器所必需的
         ' 可以使用 Windows 窗体设计器修改它。
         ' 不要使用代码编辑器修改它。
         < System.Diagnostics.DebuggerStepThrough() >  _
        
Private   Sub  InitializeComponent()
            
Me .LabelServer  =   New  System.Windows.Forms.Label
            
Me .LabelAuthentication  =   New  System.Windows.Forms.Label
            
Me .LabelUser  =   New  System.Windows.Forms.Label
            
Me .LabelPassword  =   New  System.Windows.Forms.Label
            
Me .ComboBoxServer  =   New  System.Windows.Forms.ComboBox
            
Me .ComboBoxAuthentication  =   New  System.Windows.Forms.ComboBox
            
Me .TextBoxPassword  =   New  System.Windows.Forms.TextBox
            
Me .CheckBoxRemember  =   New  System.Windows.Forms.CheckBox
            
Me .GroupBox1  =   New  System.Windows.Forms.GroupBox
            
Me .ButtonOK  =   New  System.Windows.Forms.Button
            
Me .ButtonCancel  =   New  System.Windows.Forms.Button
            
Me .ComboBoxDatabase  =   New  System.Windows.Forms.ComboBox
            
Me .LabelDatabase  =   New  System.Windows.Forms.Label
            
Me .ButtonConnect  =   New  System.Windows.Forms.Button
            
Me .GroupBox2  =   New  System.Windows.Forms.GroupBox
            
Me .LabelMessage  =   New  System.Windows.Forms.Label
            
Me .ButtonDatabase  =   New  System.Windows.Forms.Button
            
Me .TextBoxUser  =   New  System.Windows.Forms.TextBox
            
Me .SuspendLayout()
            
'
             ' LabelServer
             '
             Me .LabelServer.AutoSize  =   True
            
Me .LabelServer.Location  =   New  System.Drawing.Point( 21 19 )
            
Me .LabelServer.Name  =   " LabelServer "
            
Me .LabelServer.Size  =   New  System.Drawing.Size( 89 12 )
            
Me .LabelServer.TabIndex  =   0
            
Me .LabelServer.Text  =   " 服务器名称(&S): "
            
'
             ' LabelAuthentication
             '
             Me .LabelAuthentication.AutoSize  =   True
            
Me .LabelAuthentication.Location  =   New  System.Drawing.Point( 33 46 )
            
Me .LabelAuthentication.Name  =   " LabelAuthentication "
            
Me .LabelAuthentication.Size  =   New  System.Drawing.Size( 77 12 )
            
Me .LabelAuthentication.TabIndex  =   1
            
Me .LabelAuthentication.Text  =   " 身份验证(&T): "
            
'
             ' LabelUser
             '
             Me .LabelUser.AutoSize  =   True
            
Me .LabelUser.Enabled  =   False
            
Me .LabelUser.Location  =   New  System.Drawing.Point( 73 93 )
            
Me .LabelUser.Name  =   " LabelUser "
            
Me .LabelUser.Size  =   New  System.Drawing.Size( 65 12 )
            
Me .LabelUser.TabIndex  =   2
            
Me .LabelUser.Text  =   " 用户名(&U): "
            
'
             ' LabelPassword
             '
             Me .LabelPassword.AutoSize  =   True
            
Me .LabelPassword.Enabled  =   False
            
Me .LabelPassword.Location  =   New  System.Drawing.Point( 85 119 )
            
Me .LabelPassword.Name  =   " LabelPassword "
            
Me .LabelPassword.Size  =   New  System.Drawing.Size( 53 12 )
            
Me .LabelPassword.TabIndex  =   3
            
Me .LabelPassword.Text  =   " 密码(&P): "
            
'
             ' ComboBoxServer
             '
             Me .ComboBoxServer.FormattingEnabled  =   True
            
Me .ComboBoxServer.Location  =   New  System.Drawing.Point( 155 20 )
            
Me .ComboBoxServer.Name  =   " ComboBoxServer "
            
Me .ComboBoxServer.Size  =   New  System.Drawing.Size( 267 20 )
            
Me .ComboBoxServer.TabIndex  =   4
            
'
             ' ComboBoxAuthentication
             '
             Me .ComboBoxAuthentication.DropDownStyle  =  System.Windows.Forms.ComboBoxStyle.DropDownList
            
Me .ComboBoxAuthentication.FormattingEnabled  =   True
            
Me .ComboBoxAuthentication.Location  =   New  System.Drawing.Point( 155 46 )
            
Me .ComboBoxAuthentication.Name  =   " ComboBoxAuthentication "
            
Me .ComboBoxAuthentication.Size  =   New  System.Drawing.Size( 267 20 )
            
Me .ComboBoxAuthentication.TabIndex  =   5
            
'
             ' TextBoxPassword
             '
             Me .TextBoxPassword.Enabled  =   False
            
Me .TextBoxPassword.Location  =   New  System.Drawing.Point( 194 116 )
            
Me .TextBoxPassword.Name  =   " TextBoxPassword "
            
Me .TextBoxPassword.Size  =   New  System.Drawing.Size( 227 21 )
            
Me .TextBoxPassword.TabIndex  =   7
            
Me .TextBoxPassword.UseSystemPasswordChar  =   True
            
'
             ' CheckBoxRemember
             '
             Me .CheckBoxRemember.AutoSize  =   True
            
Me .CheckBoxRemember.Enabled  =   False
            
Me .CheckBoxRemember.Location  =   New  System.Drawing.Point( 194 143 )
            
Me .CheckBoxRemember.Name  =   " CheckBoxRemember "
            
Me .CheckBoxRemember.Size  =   New  System.Drawing.Size( 90 16 )
            
Me .CheckBoxRemember.TabIndex  =   8
            
Me .CheckBoxRemember.Text  =   " 记住密码(&M) "
            
Me .CheckBoxRemember.UseVisualStyleBackColor  =   True
            
'
             ' GroupBox1
             '
             Me .GroupBox1.Location  =   New  System.Drawing.Point( 15 256 )
            
Me .GroupBox1.Name  =   " GroupBox1 "
            
Me .GroupBox1.Size  =   New  System.Drawing.Size( 445 5 )
            
Me .GroupBox1.TabIndex  =   9
            
Me .GroupBox1.TabStop  =   False
            
'
             ' ButtonOK
             '
             Me .ButtonOK.DialogResult  =  System.Windows.Forms.DialogResult.OK
            
Me .ButtonOK.Location  =   New  System.Drawing.Point( 194 276 )
            
Me .ButtonOK.Name  =   " ButtonOK "
            
Me .ButtonOK.Size  =   New  System.Drawing.Size( 107 31 )
            
Me .ButtonOK.TabIndex  =   10
            
Me .ButtonOK.Text  =   " 确定 "
            
Me .ButtonOK.UseVisualStyleBackColor  =   True
            
'
             ' ButtonCancel
             '
             Me .ButtonCancel.DialogResult  =  System.Windows.Forms.DialogResult.Cancel
            
Me .ButtonCancel.Location  =   New  System.Drawing.Point( 315 276 )
            
Me .ButtonCancel.Name  =   " ButtonCancel "
            
Me .ButtonCancel.Size  =   New  System.Drawing.Size( 107 31 )
            
Me .ButtonCancel.TabIndex  =   11
            
Me .ButtonCancel.Text  =   " 取消 "
            
Me .ButtonCancel.UseVisualStyleBackColor  =   True
            
'
             ' ComboBoxDatabase
             '
             Me .ComboBoxDatabase.FormattingEnabled  =   True
            
Me .ComboBoxDatabase.Location  =   New  System.Drawing.Point( 167 188 )
            
Me .ComboBoxDatabase.Name  =   " ComboBoxDatabase "
            
Me .ComboBoxDatabase.Size  =   New  System.Drawing.Size( 146 20 )
            
Me .ComboBoxDatabase.TabIndex  =   13
            
'
             ' LabelDatabase
             '
             Me .LabelDatabase.AutoSize  =   True
            
Me .LabelDatabase.Location  =   New  System.Drawing.Point( 73 188 )
            
Me .LabelDatabase.Name  =   " LabelDatabase "
            
Me .LabelDatabase.Size  =   New  System.Drawing.Size( 65 12 )
            
Me .LabelDatabase.TabIndex  =   12
            
Me .LabelDatabase.Text  =   " 数据库(&D): "
            
'
             ' ButtonConnect
             '
             Me .ButtonConnect.Location  =   New  System.Drawing.Point( 23 276 )
            
Me .ButtonConnect.Name  =   " ButtonConnect "
            
Me .ButtonConnect.Size  =   New  System.Drawing.Size( 103 31 )
            
Me .ButtonConnect.TabIndex  =   14
            
Me .ButtonConnect.Text  =   " 测试连接(&C) "
            
Me .ButtonConnect.UseVisualStyleBackColor  =   True
            
'
             ' GroupBox2
             '
             Me .GroupBox2.Location  =   New  System.Drawing.Point( 75 171 )
            
Me .GroupBox2.Name  =   " GroupBox2 "
            
Me .GroupBox2.Size  =   New  System.Drawing.Size( 347 5 )
            
Me .GroupBox2.TabIndex  =   10
            
Me .GroupBox2.TabStop  =   False
            
'
             ' LabelMessage
             '
             Me .LabelMessage.AutoSize  =   True
            
Me .LabelMessage.Location  =   New  System.Drawing.Point( 21 241 )
            
Me .LabelMessage.Name  =   " LabelMessage "
            
Me .LabelMessage.Size  =   New  System.Drawing.Size( 35 12 )
            
Me .LabelMessage.TabIndex  =   15
            
Me .LabelMessage.Text  =   " 消息: "
            
'
             ' ButtonDatabase
             '
             Me .ButtonDatabase.Location  =   New  System.Drawing.Point( 319 188 )
            
Me .ButtonDatabase.Name  =   " ButtonDatabase "
            
Me .ButtonDatabase.Size  =   New  System.Drawing.Size( 103 31 )
            
Me .ButtonDatabase.TabIndex  =   16
            
Me .ButtonDatabase.Text  =   " 取数据库列表(&G) "
            
Me .ButtonDatabase.UseVisualStyleBackColor  =   True
            
'
             ' TextBoxUser
             '
             Me .TextBoxUser.Enabled  =   False
            
Me .TextBoxUser.Location  =   New  System.Drawing.Point( 194 89 )
            
Me .TextBoxUser.Name  =   " TextBoxUser "
            
Me .TextBoxUser.Size  =   New  System.Drawing.Size( 226 21 )
            
Me .TextBoxUser.TabIndex  =   17
            
'
             ' SqlLoginForm
             '
             Me .AcceptButton  =   Me .ButtonOK
            
Me .AutoScaleDimensions  =   New  System.Drawing.SizeF( 6.0 !,  12.0 !)
            
Me .AutoScaleMode  =  System.Windows.Forms.AutoScaleMode.Font
            
Me .CancelButton  =   Me .ButtonCancel
            
Me .ClientSize  =   New  System.Drawing.Size( 472 319 )
            
Me .Controls.Add( Me .TextBoxUser)
            
Me .Controls.Add( Me .ButtonDatabase)
            
Me .Controls.Add( Me .LabelMessage)
            
Me .Controls.Add( Me .GroupBox2)
            
Me .Controls.Add( Me .ButtonConnect)
            
Me .Controls.Add( Me .ComboBoxDatabase)
            
Me .Controls.Add( Me .LabelDatabase)
            
Me .Controls.Add( Me .ButtonCancel)
            
Me .Controls.Add( Me .ButtonOK)
            
Me .Controls.Add( Me .GroupBox1)
            
Me .Controls.Add( Me .CheckBoxRemember)
            
Me .Controls.Add( Me .TextBoxPassword)
            
Me .Controls.Add( Me .ComboBoxAuthentication)
            
Me .Controls.Add( Me .ComboBoxServer)
            
Me .Controls.Add( Me .LabelPassword)
            
Me .Controls.Add( Me .LabelUser)
            
Me .Controls.Add( Me .LabelAuthentication)
            
Me .Controls.Add( Me .LabelServer)
            
Me .FormBorderStyle  =  System.Windows.Forms.FormBorderStyle.FixedDialog
            
Me .MaximizeBox  =   False
            
Me .MinimizeBox  =   False
            
Me .Name  =   " SqlLoginForm "
            
Me .ShowInTaskbar  =   False
            
Me .StartPosition  =  System.Windows.Forms.FormStartPosition.CenterScreen
            
Me .Text  =   " 连接到SqlServer服务器 "
            
Me .TopMost  =   True
            
Me .ResumeLayout( False )
            
Me .PerformLayout()

        
End Sub
        
Private   WithEvents  LabelServer  As  System.Windows.Forms.Label
        
Private   WithEvents  LabelAuthentication  As  System.Windows.Forms.Label
        
Private   WithEvents  LabelUser  As  System.Windows.Forms.Label
        
Private   WithEvents  LabelPassword  As  System.Windows.Forms.Label
        
Private   WithEvents  ComboBoxServer  As  System.Windows.Forms.ComboBox
        
Private   WithEvents  ComboBoxAuthentication  As  System.Windows.Forms.ComboBox
        
Private   WithEvents  TextBoxPassword  As  System.Windows.Forms.TextBox
        
Private   WithEvents  CheckBoxRemember  As  System.Windows.Forms.CheckBox
        
Private   WithEvents  GroupBox1  As  System.Windows.Forms.GroupBox
        
Private   WithEvents  ButtonOK  As  System.Windows.Forms.Button
        
Private   WithEvents  ButtonCancel  As  System.Windows.Forms.Button
        
Private   WithEvents  ComboBoxDatabase  As  System.Windows.Forms.ComboBox
        
Private   WithEvents  LabelDatabase  As  System.Windows.Forms.Label
        
Private   WithEvents  ButtonConnect  As  System.Windows.Forms.Button
        
Private   WithEvents  GroupBox2  As  System.Windows.Forms.GroupBox
        
Friend   WithEvents  LabelMessage  As  System.Windows.Forms.Label
        
Private   WithEvents  ButtonDatabase  As  System.Windows.Forms.Button
        
Friend   WithEvents  TextBoxUser  As  System.Windows.Forms.TextBox
    
End Class
End Namespace

你可能感兴趣的:(应用类代码)