user1.frm
上传用户:bubble
上传日期:2007-03-02
资源大小:403k
文件大小:12k
- VERSION 5.00
- Begin VB.Form frmuser1
- BorderStyle = 1 'Fixed Single
- Caption = "新增用户"
- ClientHeight = 4425
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 6510
- LinkTopic = "Form2"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 4425
- ScaleWidth = 6510
- Begin VB.Frame Frame1
- Caption = "新增用户"
- ForeColor = &H000000FF&
- Height = 4215
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 6255
- Begin VB.TextBox Text1
- Appearance = 0 'Flat
- BackColor = &H80000018&
- ForeColor = &H000000FF&
- Height = 270
- IMEMode = 3 'DISABLE
- Index = 2
- Left = 4200
- PasswordChar = "*"
- TabIndex = 16
- TabStop = 0 'False
- Top = 720
- Width = 855
- End
- Begin VB.Frame Frame3
- Caption = "用户类别"
- ForeColor = &H000000FF&
- Height = 2175
- Left = 120
- TabIndex = 12
- Top = 1320
- Width = 2175
- Begin VB.OptionButton Option1
- Caption = "普通用户"
- BeginProperty Font
- Name = "楷体_GB2312"
- Size = 12
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00C00000&
- Height = 495
- Index = 2
- Left = 240
- TabIndex = 15
- Top = 1320
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Caption = "只读用户"
- BeginProperty Font
- Name = "楷体_GB2312"
- Size = 12
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00C00000&
- Height = 495
- Index = 1
- Left = 240
- TabIndex = 14
- Top = 840
- Width = 1815
- End
- Begin VB.OptionButton Option1
- Caption = "超级用户"
- BeginProperty Font
- Name = "楷体_GB2312"
- Size = 12
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00C00000&
- Height = 495
- Index = 0
- Left = 240
- TabIndex = 13
- Top = 360
- Width = 1815
- End
- End
- Begin VB.CommandButton Command2
- Caption = "取消"
- Height = 255
- Left = 4200
- TabIndex = 11
- Top = 3720
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "确定"
- Height = 255
- Left = 960
- TabIndex = 10
- Top = 3720
- Width = 1095
- End
- Begin VB.Frame Frame2
- Caption = "权限"
- ForeColor = &H000000FF&
- Height = 2175
- Left = 2400
- TabIndex = 5
- Top = 1320
- Width = 3615
- Begin VB.CheckBox Check1
- Caption = "课程与成绩管理"
- BeginProperty Font
- Name = "楷体_GB2312"
- Size = 12
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00C00000&
- Height = 255
- Index = 3
- Left = 360
- TabIndex = 9
- Top = 1560
- Width = 2175
- End
- Begin VB.CheckBox Check1
- Caption = "学生交费管理"
- BeginProperty Font
- Name = "楷体_GB2312"
- Size = 12
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00C00000&
- Height = 255
- Index = 2
- Left = 360
- TabIndex = 8
- Top = 1200
- Width = 2175
- End
- Begin VB.CheckBox Check1
- Caption = "班级与学生档案管理"
- BeginProperty Font
- Name = "楷体_GB2312"
- Size = 12
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00C00000&
- Height = 255
- Index = 1
- Left = 360
- TabIndex = 7
- Top = 840
- Width = 3135
- End
- Begin VB.CheckBox Check1
- BackColor = &H80000000&
- Caption = "系统管理"
- BeginProperty Font
- Name = "楷体_GB2312"
- Size = 12
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00C00000&
- Height = 255
- Index = 0
- Left = 360
- TabIndex = 6
- Top = 480
- Width = 2175
- End
- End
- Begin VB.TextBox Text1
- Appearance = 0 'Flat
- BackColor = &H80000018&
- ForeColor = &H000000FF&
- Height = 270
- IMEMode = 3 'DISABLE
- Index = 1
- Left = 2400
- PasswordChar = "*"
- TabIndex = 3
- TabStop = 0 'False
- Top = 720
- Width = 855
- End
- Begin VB.TextBox Text1
- Appearance = 0 'Flat
- BackColor = &H80000018&
- ForeColor = &H000000FF&
- Height = 270
- Index = 0
- Left = 2400
- TabIndex = 1
- TabStop = 0 'False
- Top = 360
- Width = 855
- End
- Begin VB.Label Label3
- Caption = "确定密码:"
- ForeColor = &H00FF0000&
- Height = 255
- Left = 3360
- TabIndex = 17
- Top = 750
- Width = 975
- End
- Begin VB.Image Image1
- Height = 480
- Left = 5280
- Picture = "user1.frx":0000
- Top = 480
- Width = 480
- End
- Begin VB.Label Label1
- Caption = "密码:"
- ForeColor = &H00FF0000&
- Height = 255
- Left = 1800
- TabIndex = 4
- Top = 750
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "新用户名:"
- ForeColor = &H00FF0000&
- Height = 255
- Left = 1440
- TabIndex = 2
- Top = 390
- Width = 975
- End
- End
- End
- Attribute VB_Name = "frmuser1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- If Trim(Text1(0).Text) = "" Then
- MsgBox "用户名不能为空!", vbExclamation + vbOKOnly, "警告"
- Text1(0).SetFocus
- Exit Sub
- End If
- If Trim(Text1(1).Text) = "" Then
- MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告"
- Text1(1).SetFocus
- Exit Sub
- End If
- If Trim(Text1(2).Text) = "" Then
- MsgBox "确认密码不能为空!", vbExclamation + vbOKOnly, "警告"
- Text1(2).SetFocus
- Exit Sub
- End If
- If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
- MsgBox "确认密码不正确!", vbExclamation + vbOKOnly, "警告"
- Text1(2).SetFocus
- Exit Sub
- End If
- Dim aa As Integer
- aa = 0
- If Option1(2).Value = True Then
- For i = 0 To 3
- If Check1(i).Value = 1 Then
- aa = 1
- Exit For
- End If
- Next i
- If aa = 0 Then
- MsgBox " 普通用户至少要有一项权限!", vbExclamation + vbOKOnly, "警告"
- Exit Sub
- End If
- End If
- Dim mrc As ADODB.Recordset
- txtsql = "select * from use where username='" & Trim(Text1(0).Text) & "'"
- Set mrc = ExecuteSQL(txtsql)
- If mrc.EOF = False Then
- MsgBox " 已存在该用户!", vbExclamation + vbOKOnly, "警告"
- Text1(0).SetFocus
- Text1(0).SelStart = 0
- Text1(0).SelLength = Len(Text1(0).Text)
- Exit Sub
- End If
- txtsql = "select * from use"
- Set mrc = ExecuteSQL(txtsql)
- mrc.AddNew
- mrc.Fields(0) = Trim(Text1(0).Text)
- mrc.Fields(1) = Trim(Text1(1).Text)
- For i = 0 To 2
- If Option1(i).Value = True Then
- Select Case i
- Case 0
- mrc.Fields("admin") = "y"
- Case 1
- mrc.Fields("readonly") = "y"
- Case 2
- For j = 0 To 3
- If Check1(j).Value = 1 Then
- Select Case j
- Case 0
- mrc.Fields("qx1") = "y"
- Case 1
- mrc.Fields("qx2") = "y"
- Case 2
- mrc.Fields("qx3") = "y"
- Case 3
- mrc.Fields("qx4") = "y"
- End Select
- End If
- Next j
- End Select
-
- End If
-
- Next i
- mrc.Update
- MsgBox " 用户添加成功!", vbExclamation + vbOKOnly, "警告"
- Text1(0).Text = ""
- Text1(1).Text = ""
- Text1(2).Text = ""
- End Sub
- Private Sub Command2_Click()
- Unload Me
- End Sub
- Private Sub Form_Load()
- Option1(2).Value = True
- End Sub
- Private Sub Form_Resize()
- Text1(0).SetFocus
- End Sub
- Private Sub Option1_Click(Index As Integer)
- If Index <> 2 Then
- For i = 0 To 3
- Check1(i).Enabled = False
- Next i
- Else
- For i = 0 To 3
- Check1(i).Enabled = True
- Next i
- End If
- End Sub