📄 frmtlogin.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form frmtlogin
BorderStyle = 1 'Fixed Single
Caption = "操作员登录管理"
ClientHeight = 6915
ClientLeft = 45
ClientTop = 330
ClientWidth = 8430
Icon = "frmtlogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 6915
ScaleWidth = 8430
Begin VB.Frame Frame2
Caption = "删除"
Height = 2055
Left = 3360
TabIndex = 10
Top = 3360
Width = 4935
Begin MSForms.CommandButton cmdDel
Height = 375
Left = 1440
TabIndex = 13
Top = 1440
Width = 1815
Caption = "删除"
PicturePosition = 327683
Size = "3201;661"
FontName = "宋体"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
Begin MSForms.CommandButton cmdDelLeft
Height = 375
Left = 1440
TabIndex = 12
Top = 840
Width = 1815
Caption = "删除左边显示的记录"
PicturePosition = 327683
Size = "3201;661"
FontName = "宋体"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
Begin MSForms.CommandButton cmdDelAll
Height = 375
Left = 1440
TabIndex = 11
Top = 240
Width = 1815
Caption = "删除所有记录"
PicturePosition = 327683
Size = "3201;661"
FontName = "宋体"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
End
Begin VB.Frame Frame1
Caption = "查找"
Height = 2295
Left = 3360
TabIndex = 1
Top = 840
Width = 4935
Begin VB.TextBox txtIDTo
Height = 270
Left = 3480
MaxLength = 4
TabIndex = 17
Top = 360
Width = 1215
End
Begin VB.TextBox txtID
Height = 270
Left = 1560
MaxLength = 4
TabIndex = 16
Top = 360
Width = 1095
End
Begin VB.OptionButton optDesc
Caption = "降序"
Height = 255
Left = 1800
TabIndex = 15
Top = 1800
Width = 975
End
Begin VB.OptionButton optAsc
Caption = "升序"
Height = 255
Left = 360
TabIndex = 14
Top = 1800
Value = -1 'True
Width = 975
End
Begin MSComCtl2.DTPicker dtpTo
Height = 255
Left = 3360
TabIndex = 9
Top = 1320
Width = 1455
_ExtentX = 2566
_ExtentY = 450
_Version = 393216
Format = 85131265
CurrentDate = 38123
End
Begin MSComCtl2.DTPicker dtpFrom
Height = 255
Left = 1560
TabIndex = 8
Top = 1320
Width = 1335
_ExtentX = 2355
_ExtentY = 450
_Version = 393216
Format = 85131265
CurrentDate = 38123
End
Begin VB.CheckBox chkTime
Caption = "按时间"
Height = 255
Left = 360
TabIndex = 7
Top = 1320
Width = 1095
End
Begin VB.CheckBox chkName
Caption = "按姓名:"
Height = 255
Left = 360
TabIndex = 6
Top = 840
Width = 975
End
Begin VB.CheckBox chkID
Caption = "按ID:"
Height = 255
Left = 360
TabIndex = 5
Top = 360
Width = 975
End
Begin VB.TextBox txtName
Height = 270
Left = 1560
TabIndex = 3
Top = 840
Width = 1815
End
Begin VB.CheckBox chkPP
Caption = "完全匹配"
Height = 255
Left = 3600
TabIndex = 2
Top = 840
Width = 1095
End
Begin VB.Line Line2
X1 = 2760
X2 = 3480
Y1 = 480
Y2 = 480
End
Begin VB.Line Line1
X1 = 2880
X2 = 3360
Y1 = 1440
Y2 = 1440
End
Begin MSForms.CommandButton cmdQuery
Height = 375
Left = 3120
TabIndex = 4
Top = 1800
Width = 1695
Caption = "查询"
PicturePosition = 327683
Size = "2990;661"
Picture = "frmtlogin.frx":0442
FontName = "宋体"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
End
Begin MSFlexGridLib.MSFlexGrid Grid1
Height = 6615
Left = 120
TabIndex = 0
Top = 120
Width = 3135
_ExtentX = 5530
_ExtentY = 11668
_Version = 393216
SelectionMode = 1
AllowUserResizing= 1
End
End
Attribute VB_Name = "frmtlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub chkTime_Click()
End Sub
Private Sub cmdDel_Click()
Dim sql As String
If Grid1.Rows > 1 Then
If MsgBox("你真的要删除吗?", vbQuestion + vbYesNo) = vbYes Then
sql = "delete * from t_login where id=" & Grid1.TextMatrix(Grid1.Row, 1)
If delwhat(sql) = True Then
Call Form_Load
MsgBox "删除成功!"
End If
End If
End If
End Sub
Private Sub cmdDelAll_Click()
Dim sql As String
If MsgBox("你真的要删除所有记录吗?", vbQuestion + vbYesNo) = vbYes Then
sql = "delete * from t_login"
If delwhat(sql) = True Then
Call Form_Load
MsgBox "删除成功!"
End If
End If
End Sub
Private Sub cmdDelLeft_Click()
Dim sql As String
If Grid1.Rows = 1 Then Exit Sub
If MsgBox("你真的要删除左边所有记录吗?", vbQuestion + vbYesNo) = vbYes Then
sql = "delete * from t_login where id=" & Grid1.TextMatrix(1, 1)
If Grid1.Rows > 2 Then
For i = 2 To Grid1.Rows - 1
sql = sql & "or id=" & Grid1.TextMatrix(i, 1)
Next
End If
If delwhat(sql) = True Then
Call Form_Load
MsgBox "删除成功!"
End If
End If
End Sub
Private Sub cmdQuery_Click()
Dim sql As String
Dim sqlHead As String
Dim sqlAdd As String
Dim sqlOrder As String
sqlHead = "select * from t_login where id=id "
'id号
If chkID = 1 Then
If txtID.Text = "" Or txtIDTo.Text = "" Then
MsgBox "不能为空"
TextFocus txtID
Exit Sub
End If
If Not IsNumeric(txtID) Then
MsgBox "ID号应为数字"
TextFocus txtID
Exit Sub
End If
If Not IsNumeric(txtIDTo) Then
MsgBox "ID号应为数字"
TextFocus txtIDTo
Exit Sub
End If
sqlAdd = sqlAdd & " and id>=" & CInt(Trim(txtID.Text)) & " and id<=" & CInt(Trim(txtIDTo.Text))
End If
'用户名
If chkName = 1 Then
'要不要完全匹配
If chkPP = 1 Then
sqlAdd = sqlAdd & " and 用户='" & Trim(txtName) & "'"
Else
sqlAdd = sqlAdd & " and 用户 like '%" & Trim(txtName) & "%'"
End If
End If
If chkTime = 1 Then
sqlAdd = sqlAdd & " and 登录时间>=#" & dtpFrom & "# and 登录时间<= #" & dtpTo & "#"
End If
If optDesc = True Then
sqlOrder = " order by id desc"
Else
sqlOrder = " order by id asc"
End If
sql = sqlHead & sqlAdd & sqlOrder
Call showData(sql, Grid1)
End Sub
Private Sub Form_Load()
Me.Left = ReadIni("操作员登录管理", "left")
Me.Top = ReadIni("操作员登录管理", "top")
Dim strSql As String
Dim strMsg As String
Dim rs As New ADODB.Recordset
strSql = "select * from t_login"
Set rs = ExecuteSQL(strSql, strMsg)
Call showData(strSql, Grid1)
If Grid1.Rows > 1 Then
Grid1.RowSel = 1
End If
End Sub
Private Function delwhat(ByVal strSql As String) As Boolean
On Error GoTo errhand1
Dim strMsg As String
Dim rs As ADODB.Recordset
Set rs = ExecuteSQL(strSql, strMsg)
delwhat = True
Exit Function
errhand1:
MsgBox strMsg
delwhat = False
End Function
Private Sub Form_Unload(Cancel As Integer)
Call WriteIni("操作员登录管理", "left", Me.Left)
Call WriteIni("操作员登录管理", "top", Me.Top)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -