frmAdduser.frm

上传用户:rocksue
上传日期:2013-06-17
资源大小:41926k
文件大小:6k
源码类别:SQL Server
开发平台:SQL
  1. VERSION 5.00
  2. Begin VB.Form frmAdduser 
  3.    Caption         =   "添加用户"
  4.    ClientHeight    =   3360
  5.    ClientLeft      =   48
  6.    ClientTop       =   348
  7.    ClientWidth     =   3864
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   3360
  10.    ScaleWidth      =   3864
  11.    StartUpPosition =   2  'CenterScreen
  12.    Begin VB.CommandButton cmdCancel 
  13.       Caption         =   "取消"
  14.       BeginProperty Font 
  15.          Name            =   "宋体"
  16.          Size            =   10.8
  17.          Charset         =   0
  18.          Weight          =   700
  19.          Underline       =   0   'False
  20.          Italic          =   0   'False
  21.          Strikethrough   =   0   'False
  22.       EndProperty
  23.       Height          =   492
  24.       Left            =   1920
  25.       TabIndex        =   7
  26.       Top             =   2520
  27.       Width           =   972
  28.    End
  29.    Begin VB.CommandButton cmdOK 
  30.       Caption         =   "确认"
  31.       BeginProperty Font 
  32.          Name            =   "宋体"
  33.          Size            =   10.8
  34.          Charset         =   0
  35.          Weight          =   700
  36.          Underline       =   0   'False
  37.          Italic          =   0   'False
  38.          Strikethrough   =   0   'False
  39.       EndProperty
  40.       Height          =   492
  41.       Left            =   600
  42.       TabIndex        =   6
  43.       Top             =   2520
  44.       Width           =   972
  45.    End
  46.    Begin VB.TextBox Text1 
  47.       BeginProperty Font 
  48.          Name            =   "宋体"
  49.          Size            =   10.8
  50.          Charset         =   0
  51.          Weight          =   700
  52.          Underline       =   0   'False
  53.          Italic          =   0   'False
  54.          Strikethrough   =   0   'False
  55.       EndProperty
  56.       Height          =   492
  57.       IMEMode         =   3  'DISABLE
  58.       Index           =   2
  59.       Left            =   1680
  60.       PasswordChar    =   "*"
  61.       TabIndex        =   3
  62.       Top             =   1800
  63.       Width           =   1572
  64.    End
  65.    Begin VB.TextBox Text1 
  66.       BeginProperty Font 
  67.          Name            =   "宋体"
  68.          Size            =   10.8
  69.          Charset         =   0
  70.          Weight          =   700
  71.          Underline       =   0   'False
  72.          Italic          =   0   'False
  73.          Strikethrough   =   0   'False
  74.       EndProperty
  75.       Height          =   492
  76.       IMEMode         =   3  'DISABLE
  77.       Index           =   1
  78.       Left            =   1680
  79.       PasswordChar    =   "*"
  80.       TabIndex        =   2
  81.       Top             =   1080
  82.       Width           =   1572
  83.    End
  84.    Begin VB.TextBox Text1 
  85.       BeginProperty Font 
  86.          Name            =   "宋体"
  87.          Size            =   10.8
  88.          Charset         =   0
  89.          Weight          =   700
  90.          Underline       =   0   'False
  91.          Italic          =   0   'False
  92.          Strikethrough   =   0   'False
  93.       EndProperty
  94.       Height          =   492
  95.       Index           =   0
  96.       Left            =   1680
  97.       TabIndex        =   0
  98.       Top             =   360
  99.       Width           =   1572
  100.    End
  101.    Begin VB.Label Label3 
  102.       Caption         =   "请确认密码"
  103.       BeginProperty Font 
  104.          Name            =   "宋体"
  105.          Size            =   10.8
  106.          Charset         =   0
  107.          Weight          =   700
  108.          Underline       =   0   'False
  109.          Italic          =   0   'False
  110.          Strikethrough   =   0   'False
  111.       EndProperty
  112.       Height          =   372
  113.       Left            =   120
  114.       TabIndex        =   5
  115.       Top             =   1800
  116.       Width           =   1452
  117.    End
  118.    Begin VB.Label Label2 
  119.       Caption         =   "请输入密码"
  120.       BeginProperty Font 
  121.          Name            =   "宋体"
  122.          Size            =   10.8
  123.          Charset         =   0
  124.          Weight          =   700
  125.          Underline       =   0   'False
  126.          Italic          =   0   'False
  127.          Strikethrough   =   0   'False
  128.       EndProperty
  129.       Height          =   372
  130.       Left            =   120
  131.       TabIndex        =   4
  132.       Top             =   1080
  133.       Width           =   1332
  134.    End
  135.    Begin VB.Label Label1 
  136.       Caption         =   "请输入用户名"
  137.       BeginProperty Font 
  138.          Name            =   "宋体"
  139.          Size            =   10.8
  140.          Charset         =   0
  141.          Weight          =   700
  142.          Underline       =   0   'False
  143.          Italic          =   0   'False
  144.          Strikethrough   =   0   'False
  145.       EndProperty
  146.       Height          =   372
  147.       Left            =   120
  148.       TabIndex        =   1
  149.       Top             =   480
  150.       Width           =   1452
  151.    End
  152. End
  153. Attribute VB_Name = "frmAdduser"
  154. Attribute VB_GlobalNameSpace = False
  155. Attribute VB_Creatable = False
  156. Attribute VB_PredeclaredId = True
  157. Attribute VB_Exposed = False
  158. Private Sub cmdCancel_Click()
  159.     Unload Me
  160. End Sub
  161. Private Sub cmdOK_Click()
  162.     Dim txtSQL As String
  163.     Dim mrc As ADODB.Recordset
  164.     Dim MsgText As String
  165.     
  166.     
  167.     If Trim(Text1(0).Text) = "" Then
  168.         MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
  169.         Exit Sub
  170.         Text1(0).SetFocus
  171.     Else
  172.         txtSQL = "select * from user_Info "
  173.         Set mrc = ExecuteSQL(txtSQL, MsgText)
  174.         While (mrc.EOF = False)
  175.             If Trim(mrc.Fields(0)) = Trim(Text1(0)) Then
  176.                 MsgBox "用户已经存在,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
  177.                 Text1(0).SetFocus
  178.                 Text1(0).Text = ""
  179.                 Text1(1).Text = ""
  180.                 Text1(2).Text = ""
  181.                 Exit Sub
  182.             Else
  183.                 mrc.MoveNext
  184.             End If
  185.         Wend
  186.     End If
  187.     
  188.     If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
  189.         MsgBox "两次输入密码不一样,请确认!", vbOKOnly + vbExclamation, "警告"
  190.         Text1(1).SetFocus
  191.         Text1(1).Text = ""
  192.         Text1(2).Text = ""
  193.         Exit Sub
  194.         
  195.     Else
  196.         If Text1(1).Text = "" Then
  197.             MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
  198.             Text1(1).SetFocus
  199.             Text1(1).Text = ""
  200.             Text1(2).Text = ""
  201.         Else
  202.             mrc.AddNew
  203.             mrc.Fields(0) = Trim(Text1(0).Text)
  204.             mrc.Fields(1) = Trim(Text1(1).Text)
  205.             mrc.Update
  206.             mrc.Close
  207.             Me.Hide
  208.             MsgBox "添加用户成功!", vbOKOnly + vbExclamation, "添加用户"
  209.         End If
  210.     End If
  211.         
  212.         
  213.         
  214. End Sub