frmdelrecord.frm
来自「企业工资管理系统的具体实现」· FRM 代码 · 共 374 行
FRM
374 行
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmdelrecord
Caption = "记录删除"
ClientHeight = 4245
ClientLeft = 2955
ClientTop = 2205
ClientWidth = 6615
Icon = "frmdelrecord.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4245
ScaleWidth = 6615
Begin MSAdodcLib.Adodc Adodc1
Height = 360
Left = 645
Top = 3045
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 635
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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 Command2
Caption = "取 消"
Height = 360
Left = 5250
TabIndex = 6
Top = 1905
Width = 1230
End
Begin VB.CommandButton Command1
Caption = "删 除"
Height = 360
Left = 4005
TabIndex = 5
Top = 1905
Width = 1230
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 1920
Left = 15
TabIndex = 4
Top = 2340
Width = 6600
_ExtentX = 11642
_ExtentY = 3387
_Version = 393216
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 6
BeginProperty Column00
DataField = "xm"
Caption = "姓名"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "xb"
Caption = "性别"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "mz"
Caption = "民族"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column03
DataField = "csrq"
Caption = "出生日期"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column04
DataField = "zz"
Caption = "住址"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column05
DataField = "sfzh"
Caption = "身份证号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnWidth = 1005.165
EndProperty
BeginProperty Column01
ColumnWidth = 794.835
EndProperty
BeginProperty Column02
ColumnWidth = 794.835
EndProperty
BeginProperty Column03
ColumnWidth = 1005.165
EndProperty
BeginProperty Column04
ColumnWidth = 1200.189
EndProperty
BeginProperty Column05
ColumnWidth = 1500.095
EndProperty
EndProperty
End
Begin VB.ListBox List1
Height = 1320
Left = 1290
MultiSelect = 1 'Simple
TabIndex = 3
Top = 990
Width = 1785
End
Begin VB.Label Label18
Caption = "身份证号:(可以多选)"
ForeColor = &H00004080&
Height = 660
Left = 375
TabIndex = 2
Top = 1155
Width = 840
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "请选择要删除职工的身份证号,注意不要误删相同姓名的职工。"
Height = 180
Left = 375
TabIndex = 1
Top = 690
Width = 5040
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "系统查到以下辞职后但没有进行删除的职工。"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00004080&
Height = 210
Left = 1320
TabIndex = 0
Top = 285
Width = 4200
End
End
Attribute VB_Name = "frmdelrecord"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim cnn As New ADODB.Recordset
Dim cnn1 As New ADODB.Recordset
Dim cnn2 As New ADODB.Connection
Dim i As Integer, j As Integer
For i = 0 To List1.ListCount - 1
If List1.Selected(i) = True Then
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select xm from bmb where sfzh='" & Trim(List1.List(i)) & "'"
With cnn1
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select wscgrdh from temp where wscxm='" & Trim(cnn.Fields("xm").Value) & "'"
With cnn2
.Open constr
.Execute "delete * from grfpb where grdh='" & Trim(cnn1.Fields("wscgrdh").Value) & "'"
For j = 1 To 12
If Len(Trim(Str$(j))) = 1 Then
.Execute "delete from sbqkb" & Trim("0" & Trim(Str$(j))) & " where grdh='" & Trim(cnn1.Fields("wscgrdh").Value) & "'"
Else
.Execute "delete from sbqkb" & Trim(Str$(j)) & " where grdh='" & Trim(cnn1.Fields("wscgrdh").Value) & "'"
End If
Next j
.Execute "delete * from gzkcb where grdh='" & Trim(cnn1.Fields("wscgrdh").Value) & "'"
.Execute "delete * from jzb where grdh='" & Trim(cnn1.Fields("wscgrdh").Value) & "'"
.Execute "delete * from ygzqkb where grdh='" & Trim(cnn1.Fields("wscgrdh").Value) & "'"
.Execute "delete * from gzzjb where grdh='" & Trim(cnn1.Fields("wscgrdh").Value) & "'"
.Execute "delete * from temp where wscgrdh='" & Trim(cnn1.Fields("wscgrdh").Value) & "'"
.Execute "delete * from bmb where sfzh='" & Trim(List1.List(i)) & "'"
.Close
End With
Set cnn2 = Nothing
.Close
End With
Set cnn1 = Nothing
.Close
End With
Set cnn = Nothing
End If
Next i
'For i = 1 To List1.SelCount
' For j = 0 To List1.ListCount - 1
' If List1.Selected(j) = True Then
' List1.RemoveItem (j)
' Exit For
' End If
' Next j
'Next i
If List1.ListCount >= 1 Then
Call frmdesplay
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Call frmdesplay
End Sub
Sub frmdesplay()
Dim cnn As New ADODB.Recordset
Dim wscxm As String
wscxm = ""
With cnn
.ActiveConnection = constr
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockPessimistic
.Open "select * from temp order by wscgrdh "
If Not (.EOF And .BOF) Then
.MoveFirst
Do While Not .EOF
If IsNull(.Fields("wscxm").Value) = False Then 'List1.AddItem .Fields("wscxm").Value
If wscxm = "" Then
wscxm = "'" & .Fields("wscxm").Value & "'"
Else
wscxm = wscxm & ",'" & .Fields("wscxm").Value & "'"
End If
End If
.MoveNext
Loop
End If
.Close
End With
Set cnn = Nothing
If wscxm <> "" Then
With Adodc1
.ConnectionString = constr
.RecordSource = "select * from bmb where xm in(" & Trim(wscxm) & ")"
.Refresh
If Not (.Recordset.EOF And .Recordset.BOF) Then
.Recordset.MoveFirst
Do While Not .Recordset.EOF
List1.AddItem .Recordset.Fields("sfzh").Value
.Recordset.MoveNext
Loop
End If
End With
Set DataGrid1.DataSource = Adodc1
Else
List1.Clear
With Adodc1
.ConnectionString = constr
.RecordSource = "select * from bmb where xm='""'"
.Refresh
End With
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?