Mostrar somente aulas do Mê atual
Olá Amigos,
Estou com uma dificuldade em minha consulta.. preciso que ao informar o nome do Professor ela me mostre somente as aulas que ele deu no atual mês , mas ele mostra todos..
Tentei usar a função abaixo sem sucesso :
<%
varMesAtual = month(date())
strSQL = "Select * from Aulas where MONTH(ven)="& varMesAtual
Set ObjRs = cnnSearch.Execute(strSQL)
%>
Segue o código completo:
<%
Dim strURL
Dim cnnSearch
Dim rstSearch
Dim strDBPath
Dim strSQL
Dim strSearch
inicio = Timer
'#Função que tira todos os acentos das palavras
function TiraAcento(StrAcento)
for i = 1 to len(StrAcento)
Letra = mid(StrAcento, i, 1)
Select Case Letra
Case "á","Á","à","À","ã","Ã","â","Â","â","ä","Ä"
Letra = "A"
Case "é","É","ê","Ê","Ë","ë","È","è"
Letra = "E"
Case "í","Í","ï","Ï","Ì","ì"
Letra = "I"
Case "ó","Ó","ô","Ô","õ","Õ","ö","Ö","ò","Ò"
Letra = "O"
Case "ú","Ú","Ù","ù","ú","û","ü","Ü","Û"
Letra = "U"
Case "ç","Ç"
Letra = "C"
Case "ñ"
Letra = "N"
End Select
texto = texto & Letra
next
TiraAcento = textoend function
strURL = Request.ServerVariables("URL")
strSearch = Request.QueryString("search")
%>
<title>WEB ADMIN</title>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<body bgcolor="#FFFFFF">
<link rel="stylesheet" media="screen" href="style.css" />
<table width="1" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2FFF2">
<tr>
<td bgcolor="#FFFFFF" width="812">
<table width="515" border="0" cellpadding="2" style="border-collapse: collapse" height="1">
<tr>
<td bgcolor="#FFFFFF" height="4" colspan="2" width="667">
<p align="left">
<span style="font-size: 14pt">Relação de Aulas por Professor</span></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" valign="middle" height="1" width="569">
<form action="<%= strURL %>" method="get">
<div align="left">
<b><font face="Arial" style="font-size: 8pt"> </font></b><b><font face="Arial" style="font-size: 8pt"><br>
<br>
Informe o Professor </font>
</b>
<span style="font-size: 11pt; font-weight: 400"><input type="text" placeholder="Categoria" size="55" name="search" value="<%= strSearch %>"></span><span style="font-size: 8pt"><font face="Arial" color="#008000">
</font>
</span>
<font face="Arial" color="#008000">
<input name="submit" type="submit" value="busca" style="font-size: 8 pt; font-weight: bold; background-color: #00699C; color:#FFFFFF; " /><span style="font-size: 8pt">
</span>
</font>
</div>
</form>
<p align="center">
<font face="Arial" style="font-size: 8pt">
<%
If strSearch <> "" Then
strDBPath = Server.MapPath("Noticias.mdb")
Const adUseClient = 3
Set cnnSearch = Server.CreateObject("ADODB.Connection")
cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
cnnSearch.CursorLocation = adUseClient
varMesAtual = month(date())
strSQL = "Select * from Aulas where MONTH(ven)="& varMesAtual
Set ObjRs = cnnSearch.Execute(strSQL)
strSQL = "SELECT nome,data,horario,unidade,ven,id " _
& "FROM Aulas " _
& "WHERE nome LIKE '%" & TiraAcento(Replace(strSearch, "'", "''")) & "%' " _
& "OR ven LIKE '%" & TiraAcento(Replace(strSearch, "'", "''")) & "%' " _
& "ORDER BY id;"
Set rstSearch = cnnSearch.Execute(strSQL)
intContador = rstSearch.RecordCount
%>
</font>
</p></td>
<td bgcolor="#FFFFFF" valign="top" height="1" width="94">
<p align="center">
<font face="Arial" style="font-size: 8pt"><a title="Imprimir" href="a">
<script language="JavaScript1.2">
<!--
function DoPrinting(){
if (!window.print){
alert("Use o Netscape ou Internet Explorer \n nas versões 4.0 ou superior!")
return
}
window.print()
}
//-->
</script>
</a>
</font></td>
</tr>
</table>
<p align="left">
<font face="Century Gothic" style="font-size: 8pt"><b> <font color="#6E9F4D"> </font><font color="#1D2447"> ( Foram encontradas <%=intContador%>
ocorrências )</font></b></font></p>
<div align="center" style="width: 502; height: 246">
<table width="690" border="0" cellpadding="4" cellspacing="0" bgcolor="#FFFFFF" style="border-collapse: collapse" bordercolor="#111111" height="1">
<tr>
<th width="39" bgcolor="#525252" align="left" style="border-bottom-style: none; border-bottom-width: medium" bordercolor="#99B5C0" height="21"><strong>
<font face="Arial" style="font-size: 8pt" color="#FFFFFF">Cod</font></strong></th>
<th width="627" bgcolor="#525252" align="left" style="border-bottom-style: none; border-bottom-width: medium" bordercolor="#99B5C0" height="21">
<strong><font color="#FFFFFF"><span style="font-size: 8pt">Nome do
Professor</span></font></strong></th>
<th width="627" bgcolor="#525252" align="left" style="border-bottom-style: none; border-bottom-width: medium" bordercolor="#99B5C0" height="21">
<strong><font color="#FFFFFF"><span style="font-size: 8pt">Data</span></font></strong></th>
<th width="627" bgcolor="#525252" align="left" style="border-bottom-style: none; border-bottom-width: medium" bordercolor="#99B5C0" height="21">
<strong><font color="#FFFFFF"><span style="font-size: 8pt">Horário</span></font></strong></th>
<th width="627" bgcolor="#525252" align="left" style="border-bottom-style: none; border-bottom-width: medium" bordercolor="#99B5C0" height="21">
<strong><font color="#FFFFFF"><span style="font-size: 8pt">Núcleo</span></font></strong></th>
<th width="184" bgcolor="#FFFFFF" align="left" style="border-bottom-style: none; border-bottom-width: medium" bordercolor="#99B5C0" height="21"> </th>
</tr>
<%
Do While Not rstSearch.EOF
%><font face="Century Gothic" style="font-size: 8pt"> </font>
<tr>
<%
id = Trim(rstSearch.Fields("id"))
Response.Write "<TR style='cursor=hand;' id="& id&" onclick=""consultarClick('"&id&"')""; class='"&fundo&"' "
Response.Write " onmouseover=""this.className='inputMouse';"" "
Response.Write " onmouseout=""this.className='"&fundo&"';"">"
%><font face="Century Gothic" style="font-size: 8pt"> </font>
<td width="39" align="left" style="border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium; border-bottom-style:solid; border-bottom-width:1" bordercolor="#6E9F4D" bgcolor="#FFFFFF" height="1"><font size="1" face="Arial"><%= rstSearch.Fields("id").Value %></font></td>
<td width="627" align="left" style="border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium; border-bottom-style:solid; border-bottom-width:1" bordercolor="#6E9F4D" bgcolor="#FFFFFF" height="1"><font size="1" face="Arial"><%= rstSearch.Fields("nome").Value %></font></td>
<td width="627" align="left" style="border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium; border-bottom-style:solid; border-bottom-width:1" bordercolor="#6E9F4D" bgcolor="#FFFFFF" height="1"><font size="1" face="Arial"><%= rstSearch.Fields("ven").Value %></font></td>
<td width="627" align="left" style="border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium; border-bottom-style:solid; border-bottom-width:1" bordercolor="#6E9F4D" bgcolor="#FFFFFF" height="1"><font size="1" face="Arial"><%= rstSearch.Fields("horario").Value %></font></td>
<td width="627" align="left" style="border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium; border-bottom-style:solid; border-bottom-width:1" bordercolor="#6E9F4D" bgcolor="#FFFFFF" height="1"><font size="1" face="Arial"><%= rstSearch.Fields("unidade").Value %></font></td>
<td width="184" align="left" style="border-style: none; border-width: medium; " bordercolor="#6E9F4D" height="1">
</td>
</tr>
<%
rstSearch.MoveNext
Loop
%><font face="Century Gothic" style="font-size: 8pt"> </font>
</table>
<p align="left">
<font face="Arial" style="font-size: 8pt">
<input type="image" src="ico_imprimir.jpg" border="0" OnClick="javascript:DoPrinting()" name="I1" alt="Imprimir"></font><p align="left"><b>
<font face="Century Gothic" style="font-size: 8pt" color="#1D2447">Sua busca foi processada em
<%response.write FormatNumber( Timer - inicio, 2 )%>
segundos.</font><font face="Century Gothic" style="font-size: 8pt" color="#6E9F4D"><br>
</font></b>
<font face="Century Gothic" style="font-size: 8pt">
<%
rstSearch.Close
Set rstSearch = Nothing
cnnSearch.Close
Set cnnSearch = Nothing
End If
%> </font>
</div></td>
</tr>
</table>
<p align="left"> </p>Discussão (25)
Carregando comentários...