www.pudn.com > vb-sql-server.rar > frmAdduser.frm, change:2003-02-12,size:6600b


VERSION 5.00 
Begin VB.Form frmAdduser  
   Caption         =   "添加用户" 
   ClientHeight    =   2136 
   ClientLeft      =   48 
   ClientTop       =   348 
   ClientWidth     =   3384 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   2136 
   ScaleWidth      =   3384 
   StartUpPosition =   2  'CenterScreen 
   Begin VB.CommandButton cmdCancel  
      Caption         =   "取消" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.8 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   372 
      Left            =   1800 
      TabIndex        =   7 
      Top             =   1680 
      Width           =   972 
   End 
   Begin VB.CommandButton cmdOK  
      Caption         =   "确认" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.8 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   372 
      Left            =   600 
      TabIndex        =   6 
      Top             =   1680 
      Width           =   972 
   End 
   Begin VB.TextBox Text1  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.8 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   324 
      IMEMode         =   3  'DISABLE 
      Index           =   2 
      Left            =   1680 
      PasswordChar    =   "*" 
      TabIndex        =   3 
      Top             =   1200 
      Width           =   1572 
   End 
   Begin VB.TextBox Text1  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.8 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   324 
      IMEMode         =   3  'DISABLE 
      Index           =   1 
      Left            =   1680 
      PasswordChar    =   "*" 
      TabIndex        =   2 
      Top             =   720 
      Width           =   1572 
   End 
   Begin VB.TextBox Text1  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.8 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   324 
      Index           =   0 
      Left            =   1680 
      TabIndex        =   0 
      Top             =   240 
      Width           =   1572 
   End 
   Begin VB.Label Label3  
      Caption         =   "请确认密码" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.8 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   252 
      Left            =   120 
      TabIndex        =   5 
      Top             =   1200 
      Width           =   1452 
   End 
   Begin VB.Label Label2  
      Caption         =   "请输入密码" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.8 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   252 
      Left            =   120 
      TabIndex        =   4 
      Top             =   720 
      Width           =   1332 
   End 
   Begin VB.Label Label1  
      Caption         =   "请输入用户名" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.8 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   252 
      Left            =   120 
      TabIndex        =   1 
      Top             =   240 
      Width           =   1452 
   End 
End 
Attribute VB_Name = "frmAdduser" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Private Sub cmdCancel_Click() 
    Unload Me 
End Sub 
 
Private Sub cmdOK_Click() 
    Dim txtSQL As String 
    Dim mrc As ADODB.Recordset 
    Dim MsgText As String 
     
     
    If Trim(Text1(0).Text) = "" Then 
        MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告" 
        Exit Sub 
        Text1(0).SetFocus 
    Else 
        txtSQL = "select * from user_Info " 
        Set mrc = ExecuteSQL(txtSQL, MsgText) 
        While (mrc.EOF = False) 
            If Trim(mrc.Fields(0)) = Trim(Text1(0)) Then 
                MsgBox "用户已经存在,请重新输入用户名!", vbOKOnly + vbExclamation, "警告" 
                Text1(0).SetFocus 
                Text1(0).Text = "" 
                Text1(1).Text = "" 
                Text1(2).Text = "" 
                Exit Sub 
            Else 
                mrc.MoveNext 
            End If 
        Wend 
    End If 
     
    If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then 
        MsgBox "两次输入密码不一样,请确认!", vbOKOnly + vbExclamation, "警告" 
        Text1(1).SetFocus 
        Text1(1).Text = "" 
        Text1(2).Text = "" 
        Exit Sub 
         
    Else 
        If Text1(1).Text = "" Then 
            MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告" 
            Text1(1).SetFocus 
            Text1(1).Text = "" 
            Text1(2).Text = "" 
        Else 
            mrc.AddNew 
            mrc.Fields(0) = Trim(Text1(0).Text) 
            mrc.Fields(1) = Trim(Text1(1).Text) 
            mrc.Update 
            mrc.Close 
            Me.Hide 
            MsgBox "添加用户成功!", vbOKOnly + vbExclamation, "添加用户" 
        End If 
    End If 
         
         
         
End Sub