


Private Sub cmdFind_Click() '查询
Dim strSQL, sTmp As String
Dim strSno, sSno As String
Dim strSname, sSname As String
Dim strSClass, sSclass As String
strSno = Trim(txtSno.Text)
strSname = Trim(txtSname.Text)
strSname = Trim(txtClass.Text)
strSQL = "select Sno,Sname,Sdept,Sclass,Cno,Cname,Grade from V_StudentCourseGrade"
sSno = ""
If ckbSno.Value = 1 Then
sSno = " Sno = '" + strSno + "'"
End If
sSname = ""
If ckbSname.Value = 1 Then
sSname = " Sname like '% " + strSname + " % '"
End If
If ckbClass.Value = 1 Then
sSclass = " S.Sclass = '" + strClass + "'"
End If
sTmp = ""
If sSno <> "" Then
If sSname <> "" Then
sTmp = sSno + " and " + sSname
If sSclass <> "" Then
sTmp = sTmp + "and" + sSclass
End If
Else
If sSclass <> "" Then
sTmp = sSno + "and" + sSclass
Else
sTmp = sSno
End If
End If
Else
If sSname <> "" Then
If sSclass <> "" Then
sTmp = sSname + "and" + sSclass
Else
sTmp = sSname
End If
Else
sTmp = sSclass
End If
End If
If Trim(sTmp) <> "" Then
strSQL = strSQL + "where" + sTmp
End If
gradeADO.ConnectionString = getConnString
gradeADO.RecordSource = strSQL
gradeADO.Refresh
End Sub