frmManager.frm
资源名称:0123..rar [点击查看]
上传用户:naidiweb
上传日期:2013-08-15
资源大小:672k
文件大小:15k
源码类别:
软件设计/软件工程
开发平台:
WORD
- VERSION 5.00
- Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
- Begin VB.Form frmManager
- BorderStyle = 1 'Fixed Single
- Caption = "管理员设置"
- ClientHeight = 2085
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 5445
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 2085
- ScaleWidth = 5445
- Begin MSAdodcLib.Adodc Adodc1
- Height = 330
- Left = 4980
- Top = 1575
- Visible = 0 'False
- Width = 1200
- _ExtentX = 2117
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 1
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
- OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = "select * from 用户表"
- Caption = "Adodc1"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin VB.CommandButton cmdExit
- Caption = "退出(&E)"
- Height = 315
- Left = 4005
- TabIndex = 5
- Top = 1695
- Width = 930
- End
- Begin VB.CommandButton Command1
- Caption = "尾记录"
- Height = 315
- Index = 3
- Left = 3090
- TabIndex = 22
- Top = 1695
- Width = 930
- End
- Begin VB.CommandButton Command1
- Caption = "下一条"
- Height = 315
- Index = 2
- Left = 2175
- TabIndex = 21
- Top = 1695
- Width = 930
- End
- Begin VB.CommandButton Command1
- Caption = "上一条"
- Height = 315
- Index = 1
- Left = 1260
- TabIndex = 20
- Top = 1695
- Width = 930
- End
- Begin VB.CommandButton Command1
- Caption = "首记录"
- Height = 315
- Index = 0
- Left = 345
- TabIndex = 19
- Top = 1695
- Width = 930
- End
- Begin VB.Frame Frame1
- Caption = "管理员信息"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00800000&
- Height = 1155
- Left = 90
- TabIndex = 6
- Top = 90
- Width = 5220
- Begin VB.TextBox Text1
- Enabled = 0 'False
- Height = 300
- Left = 1230
- TabIndex = 17
- Top = 285
- Width = 1335
- End
- Begin VB.ComboBox Combo1
- Enabled = 0 'False
- Height = 300
- ItemData = "frmManager.frx":0000
- Left = 3735
- List = "frmManager.frx":000A
- TabIndex = 12
- Text = "管理员"
- Top = 660
- Width = 1335
- End
- Begin VB.TextBox Text3
- Enabled = 0 'False
- Height = 300
- IMEMode = 3 'DISABLE
- Left = 3735
- PasswordChar = "*"
- TabIndex = 11
- Top = 285
- Width = 1335
- End
- Begin VB.TextBox Text2
- Enabled = 0 'False
- Height = 300
- IMEMode = 3 'DISABLE
- Left = 1230
- PasswordChar = "*"
- TabIndex = 10
- Top = 660
- Width = 1335
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "用户姓名:"
- Height = 180
- Left = 180
- TabIndex = 18
- Top = 285
- Width = 900
- End
- Begin VB.Label Label8
- AutoSize = -1 'True
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 180
- Left = 3570
- TabIndex = 16
- Top = 675
- Width = 90
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 180
- Left = 3570
- TabIndex = 15
- Top = 315
- Width = 90
- End
- Begin VB.Label Label6
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Left = 1065
- TabIndex = 14
- Top = 720
- Width = 135
- End
- Begin VB.Label Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Left = 1065
- TabIndex = 13
- Top = 315
- Width = 135
- End
- Begin VB.Label Label4
- AutoSize = -1 'True
- Caption = "用户类型:"
- Height = 180
- Left = 2700
- TabIndex = 9
- Top = 660
- Width = 900
- End
- Begin VB.Label Label3
- Caption = "确认密码:"
- Height = 255
- Left = 2700
- TabIndex = 8
- Top = 285
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "密 码:"
- Height = 255
- Left = 180
- TabIndex = 7
- Top = 675
- Width = 975
- End
- End
- Begin VB.CommandButton cmdCancel
- Caption = "取消(&Q)"
- Enabled = 0 'False
- Height = 315
- Left = 4005
- TabIndex = 4
- Top = 1395
- Width = 930
- End
- Begin VB.CommandButton cmdOk
- Caption = "确定 (&O)"
- Enabled = 0 'False
- Height = 315
- Left = 3090
- TabIndex = 3
- Top = 1395
- Width = 930
- End
- Begin VB.CommandButton cmdDelete
- Caption = "删除 (&D)"
- Height = 315
- Left = 2175
- TabIndex = 2
- Top = 1395
- Width = 930
- End
- Begin VB.CommandButton cmdUpdate
- Caption = "修改 (&U)"
- Height = 315
- Left = 1260
- TabIndex = 1
- Top = 1395
- Width = 930
- End
- Begin VB.CommandButton cmdAdd
- Caption = "添加 (&A)"
- Height = 315
- Left = 345
- TabIndex = 0
- Top = 1395
- Width = 930
- End
- End
- Attribute VB_Name = "frmManager"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim i As Integer
- Dim adoRs1 As New ADODB.Recordset
- Private Sub cmdAdd_Click()
- Unlockctl
- Text1 = ""
- Text2 = ""
- Text3 = ""
- Combo1.Text = ""
- Text1.SetFocus
- cmdOk.Enabled = True
- cmdCancel.Enabled = True
- cmdUpdate.Enabled = False
- cmdDelete.Enabled = False
- cmdAdd.Enabled = False
- i = 1
- End Sub
- Private Sub cmdCancel_Click()
- On Error Resume Next
- Select Case i
- Case 1
- Adodc1.Recordset.MoveFirst
- Case 2
- Adodc1.Recordset.MoveNext
- If Adodc1.Recordset.EOF Then Adodc1.Recordset.MovePrevious
- End Select
- Lockctl
- cmdCancel.Enabled = False
- cmdOk.Enabled = False
- cmdUpdate.Enabled = True
- cmdDelete.Enabled = True
- cmdAdd.Enabled = True
- End Sub
- Private Sub cmdDelete_Click()
- If MsgBox("确实要删除这条记录吗?", vbOKCancel, "系统提示") = vbOK Then
- On Error Resume Next
- Adodc1.Recordset.Delete
- Adodc1.Recordset.MoveFirst
- If Adodc1.Recordset.RecordCount > 0 Then
- showdata
- Else
- Text1.Text = ""
- Text2.Text = ""
- Text3.Text = ""
- Combo1.Text = ""
- End If
- End If
- End Sub
- Private Sub cmdExit_Click()
- On Error Resume Next
- adors.Close
- MDIForm1.StatusBar1.Panels(1).Text = ""
- Unload Me
- End Sub
- Private Sub cmdFirst_Click()
- On Error Resume Next
- adors.MoveFirst
- End Sub
- Private Sub cmdLast_Click()
- On Error Resume Next
- adors.MoveLast
- End Sub
- Private Sub cmdNext_Click()
- On Error Resume Next
- adors.MoveNext
- If Not adors.EOF Then
- Else
- MsgBox "已到末记录!", , "系统提示"
- End If
- End Sub
- Private Sub cmdOk_Click()
- If Text3 <> Text2 Then
- Text2 = ""
- Text3 = ""
- Text2.SetFocus
- MsgBox "确认密码必须与密码一致!", , "系统提示"
- Exit Sub
- End If
- Select Case i
- Case 1
- If Text1 = "" Then
- MsgBox "用户姓名不能为空", , "系统提示"
- Text1.SetFocus
- Exit Sub
- End If
- If Text2 = "" Then
- MsgBox "密码不能为空", , "系统提示"
- Text2.SetFocus
- Exit Sub
- End If
- If Text3 = "" Then
- MsgBox "确认密码不能为空", , "系统提示"
- Text3.SetFocus
- Exit Sub
- End If
- If Combo1.Text = "" Then
- MsgBox "用户类型不能为空", , "系统提示"
- Combo1.SetFocus
- Exit Sub
- End If
- Adodc1.Recordset.AddNew
- Adodc1.Recordset.Fields(0) = Text1.Text
- Adodc1.Recordset.Fields(1) = Text2.Text
- Adodc1.Recordset.Fields(2) = Combo1.Text
- Adodc1.Recordset.Update
- MsgBox "记录添加成功!", , "系统提示"
- Lockctl
- cmdUpdate.Enabled = True
- cmdDelete.Enabled = True
- cmdAdd.Enabled = True
- cmdOk.Enabled = False
- cmdCancel.Enabled = False
- Case 2
- 'adoCon.Execute ("update 用户表 set 密码='" & Text2 & "',用户类型= '" & Combo1.Text & "' where 用户姓名='" & Text1 & "'")
- On Error Resume Next
- Adodc1.Recordset.Fields(0) = Text1.Text
- Adodc1.Recordset.Fields(1) = Text2.Text
- Adodc1.Recordset.Fields(2) = Combo1.Text
- Adodc1.Recordset.Update
- MsgBox "记录修改成功!", , "系统提示"
- Lockctl
- cmdUpdate.Enabled = True
- cmdDelete.Enabled = True
- cmdAdd.Enabled = True
- cmdOk.Enabled = False
- cmdCancel.Enabled = False
- End Select
- End Sub
- Private Sub cmdUpdate_Click()
- Unlockctl
- Text1.Enabled = False
- cmdOk.Enabled = True
- cmdCancel.Enabled = True
- i = 2
- End Sub
- Private Sub Command1_Click(Index As Integer)
- On Error Resume Next
- Select Case Index
- Case 0
- Adodc1.Recordset.MoveFirst
- Case 1
- If Adodc1.Recordset.BOF = False Then
- Adodc1.Recordset.MovePrevious
- End If
- Case 2
- If Adodc1.Recordset.EOF = False Then
- Adodc1.Recordset.MoveNext
- End If
- Case 3
- Adodc1.Recordset.MoveLast
- End Select
- showdata
- End Sub
- Private Sub Form_Load()
- frmManager.Width = 5535
- frmManager.Height = 2460
- adors.Open "select * from 用户表", adoCon, adOpenKeyset, adLockOptimistic
- adors.Close
- Adodc1.RecordSource = "select * from 用户表"
- Adodc1.Refresh
- If Adodc1.Recordset.RecordCount > 0 Then showdata
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- cmdExit_Click
- End Sub
- Private Sub Text1_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then Text2.SetFocus
- End Sub
- Private Sub Text1_LostFocus()
- Set adoRs1 = adoCon.Execute("select * from 用户表 where 用户姓名='" & Text1 & "'")
- If Not adoRs1.EOF Then
- MsgBox "此用户已经存在,请重新输入用户姓名!", , "系统提示"
- Text1 = ""
- Text1.SetFocus
- Exit Sub
- End If
- adoRs1.Close
- End Sub
- Private Sub Text2_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then Text3.SetFocus
- End Sub
- Private Sub text3_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then Combo1.SetFocus
- End Sub
- Private Sub Lockctl()
- Text1.Enabled = False
- Text2.Enabled = False
- Text3.Enabled = False
- Combo1.Enabled = False
- End Sub
- Private Sub Unlockctl()
- Text1.Enabled = True
- Text2.Enabled = True
- Text3.Enabled = True
- Combo1.Enabled = True
- End Sub
- Sub showdata()
- Text1.Text = Adodc1.Recordset.Fields(0)
- Text2.Text = Adodc1.Recordset.Fields(1)
- Combo1.Text = Adodc1.Recordset.Fields(2)
- End Sub