📄 form7.frm
字号:
VERSION 5.00
Begin VB.Form Form7
BorderStyle = 4 'Fixed ToolWindow
Caption = "课程信息修改"
ClientHeight = 3630
ClientLeft = 45
ClientTop = 390
ClientWidth = 4875
LinkTopic = "Form7"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3630
ScaleWidth = 4875
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command4
Caption = "退出"
Height = 495
Left = 3120
TabIndex = 9
Top = 2880
Width = 735
End
Begin VB.CommandButton Command3
Caption = "保存"
Height = 495
Left = 1800
TabIndex = 8
Top = 2880
Width = 735
End
Begin VB.CommandButton Command2
Caption = "修改"
Height = 495
Left = 480
TabIndex = 7
Top = 2880
Width = 735
End
Begin VB.TextBox Text3
Height = 375
Left = 1440
TabIndex = 6
Top = 2040
Width = 1815
End
Begin VB.TextBox Text2
Height = 375
Left = 1440
TabIndex = 4
Top = 1440
Width = 1815
End
Begin VB.Frame Frame1
Caption = "请输入要修改的课题名"
Height = 975
Left = 240
TabIndex = 0
Top = 240
Width = 4095
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 2640
TabIndex = 2
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 375
Left = 360
TabIndex = 1
Top = 360
Width = 1815
End
End
Begin VB.Label Label2
Caption = "课程名:"
Height = 255
Left = 600
TabIndex = 5
Top = 2040
Width = 735
End
Begin VB.Label Label1
Caption = "课程号:"
Height = 255
Left = 600
TabIndex = 3
Top = 1440
Width = 735
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim mrc As New ADODB.Recordset
Private Sub Command1_Click()
Dim txtsql As String
txtsql = "select * from 课程表 where "
txtsql = txtsql & "课程=" & "'" & Trim(Text1.Text) & "'"
Set mrc = executesql(txtsql)
Text2.Text = mrc.Fields(0)
Text3.Text = mrc.Fields(1)
End Sub
Public Function executesql(ByVal sql As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = New ADODB.Connection
Dim stokens() As String
stokens = Split(sql)
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb"
If InStr(" INSERT,DELETE,UPDATE", UCase$(stokens(0))) Then
cnn.Execute sql
Else
Set rst = New ADODB.Recordset
rst.Open Trim$(sql), cnn, adOpenKeyset, adLockOptimistic
Set executesql = rst
End If
End Function
Private Sub Command2_Click()
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command3_Click()
mrc.Fields(0).Value = Text2.Text
mrc.Fields(1).Value = Text3.Text
mrc.Update
End Sub
Private Sub Command4_Click()
Me.Hide
End Sub
Private Sub Form_Load()
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb"
conn.Open connstr
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -