SQL 数据库课程设计学生成绩系统
4.5.3.1.
窗体设计
SQL 数据库课程设计学生成绩系统
4.5.3.2. 代码设计
查询(Command1)处理(Click )
Private Sub Command1_Click() Dim s1 As String
s1 = ""
If Check1.Value = 1 Then If Text1.Text <> "" Then
s1 = s1 & "姓名='" & Text1.Text & "'" End If
End If
If Check2.Value = 1 Then If Text2.Text <> "" Then If s1 <> "" Then
s1 = s1 & " and " End If
s1 = s1 & "学号='" & Text2.Text & "'" End If
End If
If Check3.Value = 1 Then
If DataList1.Text <> "" Then If s1 <> "" Then
s1 = s1 & " and " End If
s1 = s1 & "班级名称='" & DataList1.Text & "'" End If End If
If s1 <> "" Then
s1 = "where " & s1
End If
Adodc1.RecordSource = "select * from 学生基本信息表 " & s1 Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 End Sub
退出(Command2)处理(Click)
Private Sub Command2_Click() Unload Me End Sub
窗体装载处理程序(Load)
Private Sub Form_Load()
DataGrid1.AllowAddNew = False