End Sub
Private Sub callmain() gridsave = False gridedit = True griddelete = True
Set qy1 = cnn.Execute(\登陆\Grid1.Rows = 1 '清除所有记录 i = 3
Grid1.Cols = i + 1 '必须+2,因为实际上为11行,但第一行是隐藏的 For i = 0 To 2 '显示数据的字段名
Grid1.Cell(0, i + 1).Text = qy1.Fields(i).Name '读取表中的各字段名 Next i = 1
Do While Not qy1.EOF
Grid1.Rows = Grid1.Rows + 1 For j = 1 To 3 '设定读取列
If qy1.Fields(j - 1) = Null Then '空值的处理 Grid1.Cell(i, j).Text = \ Else
Grid1.Cell(i, j).Text = qy1.Fields(j - 1) End If Next
i = i + 1
qy1.MoveNext '读取下一记录 Loop
Grid1.Column(1).Locked = True End Sub
Private Sub Form_Unload(Cancel As Integer) Call XPButton5_Click End Su
Private Sub Grid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = 2 Then PopupMenu cz End If End Sub
Private Sub Grid1_RowColChange(ByVal Row As Long, ByVal Col As Long) hang = Row End Sub
Private Sub Grid1_Validate(Cancel As Boolean) '设定TAB键切换 Dim nActiveRow As Long, nActiveCol As Long Const VK_TAB = 9
If GetKeyState(VK_TAB) < 0 Then
nActiveRow = Grid1.ActiveCell.Row
nActiveCol = Grid1.ActiveCell.Col If nActiveCol < Grid1.Cols - 1 Then
Grid1.Range(nActiveRow, nActiveCol + 1, _
nActiveRow, nActiveCol + 1).Selected End If
Cancel = True End If End Sub
Private Sub renovate_Click() Call callmain End Sub
Private Sub XPButton1_Click() gridsave = True gridedit = False griddelete = False
Set qy1 = cnn.Execute(\登陆\Grid1.Rows = 1 '清除所有记录 Grid1.Rows = 2 '默认为2行 i = 3
Grid1.Cols = i + 1 '必须+2,因为实际上为11行,但第一行是隐藏的 For i = 0 To 2 '显示数据的字段名
Grid1.Cell(0, i + 1).Text = qy1.Fields(i).Name '读取表中的各字段名 Next
Grid1.Column(1).Locked = False Grid1.Cell(1, 1).SetFocus End Sub
Private Sub XPButton2_Click() If gridsave = False Then
MsgBox \不支持保存操作!\当前不支持\Exit Sub End If
If Grid1.Cell(1, 1).Text <> \
Set qy1 = cnn.Execute(\* from 登陆 where 用户名='\& Grid1.Cell(1, 1).Text & \ If qy1.EOF = True Then
Set qy1 = cnn.Execute(\into 登陆 values('\& Grid1.Cell(1, 1).Text & \& Grid1.Cell(1, 2).Text & \& Grid1.Cell(1, 3).Text & \
MsgBox \提交成功!\ Call callmain Else
MsgBox \该管理员己存在!\不可重名\ Exit Sub End If
Else
MsgBox \用户名不可以是空格\错误提示\End If End Sub
Private Sub XPButton3_Click() If gridedit = False Then
MsgBox \当前修改操作不被允许!\非使用对象\Exit Sub End If
For i = 1 To Grid1.Rows - 1
Set qy1 = cnn.Execute(\登陆 set 密码='\& Grid1.Cell(i, 2).Text & \权限='\& Grid1.Cell(i, 3).Text & \where 用户名='\ Next
MsgBox \修改的数据己经完成\完成操作\ Call callmain End Sub
Private Sub XPButton4_Click() If griddelete = False Then
MsgBox \当前删除操作不被允许!\非使用对象\Exit Sub End If
If hang = 0 Then Exit Sub End If
If Grid1.Cell(hang, 1).Text = \Exit Sub End If
Set qy1 = cnn.Execute(\from 登陆 where 用户名='\& Grid1.Cell(hang, 1).Text & \
MsgBox \目标己删除,请刷新数据!\删除成功\Call callmain End Sub
Private Sub XPButton5_Click() Unload Me
form1.WindowState = 0 End Sub Form3:
Private backFile As String Private qs As String Private buff As String Dim pnum As Integer
Private Sub Form_Load()
Text1.BackColor = RGB(98, 162, 207) Text2.BackColor = RGB(98, 162, 207) End Sub
Private Sub Command1_Click() On Error GoTo finish Set qy1 = cnn.Execute(\* from 登陆 where 用户名='\& Text1.Text & \密码='\If qy1.EOF = True Then If pnum < 2 Then pnum = pnum + 1
MsgBox \用户名或密码错误!\错误次数:\ Text1.Text = \ Text2.Text = \ Text1.SetFocus Exit Sub Else
MsgBox \用户名或密码错误超过三次,系统会自动退出\提示\ End End If Else
If qy1.Fields(2) = \超级管理员\ admin = True Else
admin = False
End If Unload Me form1.Show End If Exit Sub finish:
MsgBox Err.Description End Sub
Private Sub Command2_Click() End
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Call Command1_Click End If End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Call Command1_Click End If End Sub Form4:
Private Declare Function GetKeyState Lib \ (ByVal nVirtKey As Long) As Integer
Private Sub Form_Load()
Grid1.SetRegisterInformation
\进行注册 With Grid1
.AllowUserResizing = True .DisplayFocusRect = False .ExtendLastCol = True .Appearance = Flat
.FixedRowColStyle = Flat .ScrollBarStyle = Flat
.DefaultFont.Name = \ .DefaultFont.SIZE = 8
.BackColorFixed = RGB(90, 158, 214)
.BackColorFixedSel = RGB(110, 180, 230) .BackColorBkg = RGB(90, 158, 214)
.BackColorScrollBar = RGB(231, 235, 247) .BackColor1 = RGB(231, 235, 247) .BackColor2 = RGB(239, 243, 255)
\