📄 course_add.frm
字号:
VERSION 5.00
Begin VB.Form course_add
Caption = "课程信息添加"
ClientHeight = 7695
ClientLeft = 60
ClientTop = 450
ClientWidth = 9030
LinkTopic = "Form2"
ScaleHeight = 7695
ScaleWidth = 9030
StartUpPosition = 3 '窗口缺省
Begin VB.Frame course_add
Height = 7335
Left = 240
TabIndex = 0
Top = 120
Width = 8295
Begin VB.CommandButton Command3
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 705
Left = 6000
TabIndex = 9
Top = 5400
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "清除"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 705
Left = 3240
TabIndex = 8
Top = 5400
Width = 1455
End
Begin VB.CommandButton Command1
Cancel = -1 'True
Caption = "添加"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 705
Left = 480
TabIndex = 7
Top = 5400
Width = 1455
End
Begin VB.TextBox Text1
Height = 495
Index = 2
Left = 2880
TabIndex = 6
Top = 3480
Width = 2055
End
Begin VB.TextBox Text1
Height = 495
Index = 1
Left = 2880
TabIndex = 5
Top = 2400
Width = 2055
End
Begin VB.TextBox Text1
Height = 495
Index = 0
Left = 2880
TabIndex = 4
Top = 1320
Width = 2055
End
Begin VB.Label Label4
BackColor = &H8000000E&
BackStyle = 0 'Transparent
Caption = "请输入需添加的课程信息"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 0
TabIndex = 10
Top = 0
Width = 6495
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "课程名称:"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Left = 360
TabIndex = 3
Top = 2400
Width = 2700
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学 分:"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Left = 360
TabIndex = 2
Top = 3480
Width = 2760
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "课 程 号:"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Left = 360
TabIndex = 1
Top = 1320
Width = 2730
End
Begin VB.Image Image1
Height = 11520
Left = 0
Picture = "course_add.frx":0000
Top = 0
Width = 15360
End
End
End
Attribute VB_Name = "course_add"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim txtSQL As String
Dim myconn As New ADODB.Connection
mySQL = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;"
mySQL = mySQL + "Initial Catalog=学生信息管理系统;"
myconn.ConnectionString = mySQL
myconn.Open
Dim aa As Integer
Dim ss As Integer
Dim bb As Integer
Dim cc As Integer
Dim dd As Integer
txtSQL = ""
If Trim(Text1(0).Text) = "" Then
aa = 1
Else
txtSQL = "('" & Trim(Text1(0).Text) & "'"
End If
If Trim(Text1(1).Text) = "" Then
bb = 1
Else
txtSQL = txtSQL & ",'" & Trim(Text1(1).Text) & "',"
End If
If Trim(Text1(2).Text) = "" Then
cc = 1
Else
txtSQL = txtSQL & Trim(Text1(2).Text) & ")"
End If
If aa = 1 Then
ss = MsgBox("课程号不能缺!", 0, " 警告")
Text1(0).SetFocus
End If
If bb = 1 Then
ss = MsgBox("课程名称不能缺!", 0, " 警告")
Text1(1).SetFocus
End If
If cc = 1 Then
ss = MsgBox("学分不能缺!", 0, " 警告")
Text1(2).SetFocus
End If
Dim str As String
str = "INSERT into course(课程号,课程名称,学分) values " & txtSQL
myconn.Execute (str)
ss = MsgBox("登记成功!", , "信息")
End Sub
Private Sub Command2_Click()
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -