📄 srank.frm
字号:
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 srank
Caption = "S型座位编排结果"
ClientHeight = 5220
ClientLeft = 1110
ClientTop = 600
ClientWidth = 5115
KeyPreview = -1 'True
LinkTopic = "Form1"
ScaleHeight = 5220
ScaleWidth = 5115
Begin VB.PictureBox picButtons
Align = 2 'Align Bottom
Appearance = 0 'Flat
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 420
Left = 0
ScaleHeight = 420
ScaleWidth = 5115
TabIndex = 1
Top = 4800
Width = 5115
Begin VB.CommandButton Command1
Caption = "开始编排"
Height = 375
Left = 240
TabIndex = 3
Top = 0
Width = 975
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 2880
Top = 0
Visible = 0 'False
Width = 1215
_ExtentX = 2143
_ExtentY = 582
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 = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\提交例子\zwbp\data\data.mdb"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\提交例子\zwbp\data\data.mdb"
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 cmdClose
Caption = "关闭(&C)"
Height = 300
Left = 1560
TabIndex = 2
Top = 0
Width = 1095
End
End
Begin MSAdodcLib.Adodc datPrimaryRS
Align = 2 'Align Bottom
Height = 330
Left = 0
Top = 4470
Width = 5115
_ExtentX = 9022
_ExtentY = 582
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 = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\提交例子\zwbp\data\data.mdb"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\提交例子\zwbp\data\data.mdb"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from classroom"
Caption = " "
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 MSDataGridLib.DataGrid grdDataGrid
Align = 1 'Align Top
Bindings = "srank.frx":0000
Height = 4335
Left = 0
TabIndex = 0
Top = 0
Width = 5115
_ExtentX = 9022
_ExtentY = 7646
_Version = 393216
AllowUpdate = -1 'True
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
AllowAddNew = -1 'True
AllowDelete = -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 = 5
BeginProperty Column00
DataField = "seatid"
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 = "seatrow"
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 = "searcol"
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 = "seatflag"
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 = "stid"
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 = 734.74
EndProperty
BeginProperty Column01
ColumnWidth = 734.74
EndProperty
BeginProperty Column02
ColumnWidth = 734.74
EndProperty
BeginProperty Column03
ColumnWidth = 915.024
EndProperty
BeginProperty Column04
ColumnWidth = 1094.74
EndProperty
EndProperty
End
End
Attribute VB_Name = "srank"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If bpflag = True Then
MsgBox "请先设置座位信息!"
Else
'进行S型编排
Dim i, j, k, l, n As Integer
Dim flag As Boolean
Dim i1, j1, k1 As Integer
datPrimaryRS.RecordSource = "select * from classroom"
datPrimaryRS.Refresh
Adodc1.RecordSource = "select * from student"
Adodc1.Refresh
k = Adodc1.Recordset.RecordCount
l = datPrimaryRS.Recordset.RecordCount
If l < k * (emptyseat + 1) Then
MsgBox "座位不够!"
Exit Sub
Else
Adodc1.Recordset.MoveFirst
i = 1
j = 1
flag = True '表示正序
'开始编排座位
datPrimaryRS.Recordset.MoveFirst
For n = 1 To k
datPrimaryRS.Recordset.Fields(3) = True
datPrimaryRS.Recordset.Fields(4) = Adodc1.Recordset.Fields(0)
datPrimaryRS.Recordset.Update
If i <= (seatcol - emptyseat) And n < k Then
If flag = False Then '倒序
If j > 1 Then
j = j - 1
Else
i = i + emptyseat + 1
flag = True
j = 1
End If
Else '正序
If j < seatrow Then
j = j + 1
Else
i = i + emptyseat + 1
flag = False
j = seatrow
End If
End If
k1 = zw(i, j)
datPrimaryRS.Recordset.Move k1 - 1, adBookmarkFirst
Adodc1.Recordset.MoveNext
End If
Next n
End If
'最后一个保存时,需要保存两次,?
datPrimaryRS.Recordset.Fields(3) = True
datPrimaryRS.Recordset.Fields(4) = Adodc1.Recordset.Fields(0)
datPrimaryRS.Recordset.Update
'显示编排结果
datPrimaryRS.RecordSource = "select * from classroom "
datPrimaryRS.Refresh
bpflag = True
End If
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -