📄 v6bj11-12a.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form1
Caption = "VB6 例11-11a 使用UPDATEL方法修改记录"
ClientHeight = 1710
ClientLeft = 60
ClientTop = 345
ClientWidth = 5205
LinkTopic = "Form1"
ScaleHeight = 1710
ScaleWidth = 5205
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "修改"
Height = 315
Left = 3660
TabIndex = 1
Top = 1380
Width = 1035
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Bindings = "V6bj11-12a.frx":0000
Height = 1275
Left = 120
TabIndex = 0
Top = 60
Width = 4575
_ExtentX = 8070
_ExtentY = 2249
_Version = 393216
FixedCols = 0
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 120
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 1320
Width = 2835
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim db As Database, sql As String, mpath As String
mpath = App.Path
If Right(mpath, 1) <> "\" Then mpath = mpath + "\"
Set db = OpenDatabase(mpath + "Student.mdb")
sql = "Update temp SET 平均成绩 = 平均成绩 * 1.1"
db.Execute sql
Data1.Refresh
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim db As Database, sql As String, mpath As String
mpath = App.Path
If Right(mpath, 1) <> "\" Then mpath = mpath + "\"
Set db = OpenDatabase(mpath + "Student.mdb")
sql = "Select Top 5 学号,Avg(成绩) As 平均成绩 Into temp "
sql = sql & " From 学生成绩表 Group by 学号 Order By Avg(成绩) Desc"
db.Execute "Drop Table temp;"
db.Execute sql
Data1.DatabaseName = mpath + "student.mdb"
Data1.RecordSource = "Select 基本情况.学号, 基本情况.姓名, " _
& " 基本情况.专业,基本情况.性别,temp.平均成绩" _
& " From 基本情况,temp Where 基本情况.学号=temp.学号"
Data1.Refresh
db.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -