frmingride.frm
来自「VB ACCESSS数据库课程设计」· FRM 代码 · 共 612 行 · 第 1/2 页
FRM
612 行
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
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 MSAdodcLib.Adodc adoadd
Height = 330
Left = 2160
Top = 4920
Visible = 0 'False
Width = 1680
_ExtentX = 2963
_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.4.0;Data Source=student.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
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 MSAdodcLib.Adodc adoingride
Height = 330
Left = 360
Top = 4920
Visible = 0 'False
Width = 1680
_ExtentX = 2963
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 4
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.4.0;Data Source=student.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
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 MSAdodcLib.Adodc adononame
Height = 330
Left = 4080
Top = 4560
Visible = 0 'False
Width = 2145
_ExtentX = 3784
_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.4.0;Data Source=student.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
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
End
Attribute VB_Name = "frmingride"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cboclass_Click()
If Trim$(cbocource.Text) = "" Then Exit Sub
Call getoldgrade
Call maketemptable
cmdok.Enabled = True
End Sub
Private Sub cbocource_Click()
If Trim$(cboclass.Text) = "" Then Exit Sub
Call getoldgrade
Call maketemptable
cmdok.Enabled = True
End Sub
Private Sub cmdcancel_Click()
If adoingride.Recordset Is Nothing Then Exit Sub
adoingride.Recordset.CancelBatch
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdok_Click()
Dim rp As Integer
rp = MsgBox("“确认输入”后将无法取消,是否继续?", vbQuestion + vbYesNo, "提示")
If rp = vbNo Then Exit Sub
cmdok.Enabled = False
'将临时表中的数据追加到成绩表中
With adoingride.Recordset
If .RecordCount = 0 Then Exit Sub
.MoveFirst
Do Until .EOF
If Not IsNull(.Fields("分数")) Then
adoadd.Recordset.AddNew
adoadd.Recordset("学号") = .Fields("学号").Value
adoadd.Recordset("课程") = cbocource.Text
adoadd.Recordset("分数") = .Fields("分数").Value
adoadd.Recordset.Update
End If
.MoveNext
Loop
End With
Dim sngwait As Single
sngwait = Timer
Do Until Timer - sngwait > 1#
'frawait.Visible = True
DoEvents
Loop
'frawait.Visible = False
MsgBox "添加成绩成功。", vbInformation
Call cbocource_Click
End Sub
Private Sub Form_Load()
adoadd.RecordSource = "select * from 课程信息"
adoadd.Refresh
With adoadd.Recordset
Do Until .EOF
cbocource.AddItem .Fields("课程").Value
.MoveNext
Loop
End With
Call addclassitem(cboclass)
cmdok.Enabled = False
adoadd.RecordSource = "select * from 成绩"
adoadd.Refresh
adoingride.LockType = adLockBatchOptimistic
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmMain.Show
End Sub
Private Sub getoldgrade()
Dim sql As String
sql = "select 成绩.学号 as 学号,学籍.姓名 as 姓名,成绩.分数 as 分数 from 成绩,学籍 where 成绩.学号=学籍.学号 and 成绩.课程='" & cbocource.Text & "' and 学籍.班级='" & cboclass.Text & "'"
adooldgride.RecordSource = sql
adooldgride.Refresh
'设置datagrid控件
With dgdgrade
Set .DataSource = adooldgride
.Columns(0).Width = 1200
.Columns(1).Width = 1200
.AllowUpdate = False
End With
End Sub
Private Sub maketemptable()
Dim sql As String
adoingride.RecordSource = "select * from 临时"
adoingride.Refresh
With adoingride.Recordset
Do While .RecordCount > 0
.MoveFirst
.Delete
Loop
.UpdateBatch
End With
sql = "select 学号,姓名 from 学籍 where 班级='" & cboclass.Text & "'"
adononame.RecordSource = sql
adononame.Refresh
With adononame.Recordset
Do Until .EOF
If adooldgride.Recordset.RecordCount > 0 Then
adooldgride.Recordset.MoveFirst
End If
adooldgride.Recordset.Find "学号='" & .Fields("学号").Value & "'"
If adooldgride.Recordset.EOF Then
adoingride.Recordset.AddNew
adoingride.Recordset("学号") = .Fields("学号").Value
adoingride.Recordset("姓名") = .Fields("姓名").Value
End If
.MoveNext
Loop
adoingride.Recordset.UpdateBatch
End With
With dgdingride
Set .DataSource = adoingride
.AllowUpdate = True
.Columns(0).Locked = True
.Columns(1).Locked = True
.Columns(0).Width = 1100
.Columns(1).Width = 1100
If adoingride.Recordset.RecordCount > 0 Then
.Col = 2
.Row = 0
.SetFocus
End If
End With
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?