claytonprog Postado Outubro 21, 2007 Denunciar Share Postado Outubro 21, 2007 Pessoal tenho esse codigo aqui não dá erro mais também não me retorna nada. alguém pode dizer onde eu errei!!!!<% ' Declare our variables... always good practice! Dim strURL ' The URL of this page so the form will work ' no matter what this file is named. Dim cnnSearch ' ADO connection Dim rstSearch ' ADO recordset Dim strDBPath ' path to our Access database (*.mdb) file Dim strSQL ' The SQL Query we build on the fly Dim strSearch ' The text being looked for strSearch = Request.QueryString("search") %> <p> </p> <table width="41%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F5F5FA"> <tr> <td><p align="center"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033"> :: Selecione o Docente :</font>:</STRONG></FONT></p> <form action="<%= search %>" method="get"> <div align="center"> <select name="Search" class="formula1" style="width:150" > <option value="Todos">Todos</option> <% Response.Expires = -1 Dim objConnCur, stringSQL Set objConnCur = Server.CreateObject("ADODB.Connection") Set objRSCur = Server.CreateObject("ADODB.Connection") objConnCur.Open "DBQ=" & Server.MapPath("painel/db/docentes.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}" stringSQL = "SELECT id_docente, login FROM Tbldocentes ORDER BY login ASC" Set objRSCur = objConnCur.Execute(stringSQL) While not objRSCur.eof %> <option value="<%=objRSCur("id_docente")%>"><%=objRSCur("login")%></option> <% objRSCur.MoveNext Wend objRSCur.Close %> </select> <input name="submit" type="submit" value="Pesquisar" /> </div> </form> <p align="center"> <% If strSearch <> "" Then strDBPath = Server.MapPath("painel/db/downloads_professor.mdb") Set cnnSearch = Server.CreateObject("ADODB.Connection") cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";" 'cnnSearch.Open Application("SQLConnString") strSQL = "SELECT * from tblarquivos where professor ='"&strSearch&"'" Set rstSearch = cnnSearch.Execute(strSQL) %> </p> <div align="center"> <table border="0" cellpadding="4" cellspacing="1" width="403"> <tr> <th bgcolor="#6699CC"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: Professor :</font>:</STRONG></FONT></th> <th bgcolor="#6699CC" width="164"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: Arquivo:</font>:</STRONG></FONT></th> </tr> <% Do While Not rstSearch.EOF %> <tr> <td bgcolor="#D7F2FF"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%= rstSearch.Fields("Login").Value %></font></td> <td bgcolor="#D7F2FF" width="164"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href='painel/pdf/"<%= rstSearch.Fields("filename").Value %> "' target='_blank' style='font-color:#000000'><img src='images/downloads.gif' border='0'></a></font></div></td> </tr> <% rstSearch.MoveNext Loop %> </table> <% rstSearch.Close Set rstSearch = Nothing cnnSearch.Close Set cnnSearch = Nothing End If ' That's all folks! See it's really not all that hard. %> </div></td> </tr> </table> <p> </p> Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 Guest Marcio Alves Vieira Postado Outubro 21, 2007 Denunciar Share Postado Outubro 21, 2007 <%' Declare our variables... always good practice!Dim strURL ' The URL of this page so the form will work' no matter what this file is named.Dim cnnSearch ' ADO connectionDim rstSearch ' ADO recordsetDim strDBPath ' path to our Access database (*.mdb) fileDim strSQL ' The SQL Query we build on the flyDim strSearch ' The text being looked forstrSearch = Request.QueryString("search")%><p> </p><table width="41%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F5F5FA"><tr><td><p align="center"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: Selecione o Docente :</font>:</STRONG></FONT></p><form action="<%= search %>" method="get"><div align="center"><%Response.Expires = -1Dim objConnCur, stringSQL'Conexão HC ACCESS'Set ObjConn=Server.CreateObject("ADODB.Connection")'ObjConn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=c:\inetpub\wwwroot\mexames\mexames.mdb" 'ObjConn.CursorLocation = 3Set objConnCur = Server.CreateObject("ADODB.Connection")Set objRSCur = Server.CreateObject("ADODB.Connection")objConnCur.Open "DBQ=" & Server.MapPath("../mexames/mexames.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"'ObjConn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=c:\inetpub\wwwroot\mexames\mexames.mdb" stringSQL = "SELECT * FROM tab_consulta"Set objRSCur = objConnCur.Execute(stringSQL)While not objRSCur.eof %><select name="Search" class="formula1" style="width:150" ><option value="Todos" selected="selected">Todos</option><option value="seu_valor1"<% If ObjRSCur("seu_campo")="seu_valor1" Then Response.Write "selected"%>>seu_valor1</option>><option value="seu_valor2"<% If ObjRSCur("seu_campo")="seu_valor2" Then Response.Write "selected"%>>seu_valor2</option>><%objRSCur.MoveNextWendobjRSCur.Close%></select><input name="submit" type="submit" value="Pesquisar" /></div></form><p align="center"> <%If strSearch <> "" ThenstrDBPath = Server.MapPath("painel/db/downloads_professor.mdb")Set cnnSearch = Server.CreateObject("ADODB.Connection")cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"'cnnSearch.Open Application("SQLConnString")strSQL = "SELECT * from tblarquivos where professor ='"&strSearch&"'"Set rstSearch = cnnSearch.Execute(strSQL)%></p><div align="center"><table border="0" cellpadding="4" cellspacing="1" width="403"><tr> <th bgcolor="#6699CC"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: Professor :</font>:</STRONG></FONT></th><th bgcolor="#6699CC" width="164"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: Arquivo:</font>:</STRONG></FONT></th></tr><%Do While Not rstSearch.EOF%><tr> <td bgcolor="#D7F2FF"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%= rstSearch.Fields("Login").Value %></font></td><td bgcolor="#D7F2FF" width="164"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href='painel/pdf/"<%= rstSearch.Fields("filename").Value %> "' target='_blank' style='font-color:#000000'><img src='images/downloads.gif' border='0'></a></font></div></td></tr><%rstSearch.MoveNextLoop%></table><%rstSearch.CloseSet rstSearch = NothingcnnSearch.CloseSet cnnSearch = NothingEnd If' That's all folks! See it's really not all that hard.%></div></td></tr></table><p> </p> Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 claytonprog Postado Outubro 21, 2007 Autor Denunciar Share Postado Outubro 21, 2007 Gostaria de agradecer ao Márcio valeu mesmo mano ta funfando legal. ai está o codigo corrgido pra quem precisar.<% ' Declare our variables... always good practice! Dim strURL ' The URL of this page so the form will work ' no matter what this file is named. Dim cnnSearch ' ADO connection Dim rstSearch ' ADO recordset Dim strDBPath ' path to our Access database (*.mdb) file Dim strSQL ' The SQL Query we build on the fly Dim strSearch ' The text being looked for strSearch = Request.QueryString("search") %> <p> </p> <table width="41%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F5F5FA"> <tr> <td><p align="center"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033"> :: Selecione o Docente :</font>:</STRONG></FONT></p> <form action="<%= search %>" method="get"> <div align="center"> <select name="Search" class="formula1" style="width:150" > <option value="Todos">Selecione</option> <% Response.Expires = -1 Dim objConnCur, stringSQL Set objConnCur = Server.CreateObject("ADODB.Connection") Set objRSCur = Server.CreateObject("ADODB.Connection") objConnCur.Open "DBQ=" & Server.MapPath("painel/db/docentes.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}" stringSQL = "SELECT id_docente, login FROM Tbldocentes ORDER BY login ASC" Set objRSCur = objConnCur.Execute(stringSQL) While not objRSCur.eof %> <option value="<%=objRSCur("login")%>"><%=objRSCur("login")%></option> <% objRSCur.MoveNext Wend objRSCur.Close %> </select> <input name="submit" type="submit" value="Pesquisar" /> </div> </form> <p align="center"> <% If strSearch <> "" Then strDBPath = Server.MapPath("painel/db/downloads_professor.mdb") Set cnnSearch = Server.CreateObject("ADODB.Connection") cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";" 'cnnSearch.Open Application("SQLConnString") strSQL = "SELECT * from tblarquivos where professor ='"&strSearch&"'" Set rstSearch = cnnSearch.Execute(strSQL) %> </p> <div align="center"> <table border="0" cellpadding="4" cellspacing="1" width="403"> <tr> <th bgcolor="#6699CC"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: Professor :</font>:</STRONG></FONT></th> <th bgcolor="#6699CC" width="164"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: Arquivo:</font>:</STRONG></FONT></th> </tr> <% Do While Not rstSearch.EOF %> <tr> <td bgcolor="#D7F2FF"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%= rstSearch.Fields("professor").Value %></font></td> <td bgcolor="#D7F2FF" width="164"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href='painel/pdf/<%= rstSearch.Fields("filename").Value %>' target='_blank' style='font-color:#000000'><img src='images/downloads.gif' border='0'></a></font></div></td> </tr> <% rstSearch.MoveNext Loop %> </table> <% rstSearch.Close Set rstSearch = Nothing cnnSearch.Close Set cnnSearch = Nothing End If ' That's all folks! See it's really not all that hard. %> </div></td> </tr> </table> <p> </p> Citar Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
claytonprog
Pessoal tenho esse codigo aqui não dá erro mais também não me retorna nada. alguém pode dizer onde eu errei!!!!
Link para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.