Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Galera eh o seguinte tenhu um site onde eu diversas vezes faço consultas numa mesma página ao banco de dados!!!
Eu gostaria de saber se tem como eu fazer de oura forma vo mostra pra vcs o código!
aki eh o arquivo de conexão com o banco
<% sub abre_banco Set banco = Server.CreateObject("ADODB.Connection") banco.Open "DBQ=e:\home\mercosulweb\dados\banco_cli.mdb;Driver={Microsoft Access Driver (*.mdb)}" end sub sub fecha_banco banco.close Set banco=nothing end sub%>aki varias consultas!!
<% StrSql="Select * from clientes,processos where clientes.acesso='"&codigox&"'" StrSql= StrSql & " and clientes.cadastro=processos.cadastro_proc" set tbBanco1=banco.Execute(strSQL) 'response.Write(strsql) 'response.End() if not tbbanco1.eof then While not tbbanco1.eof novadata=RIGHT("0" & DAY(tbbanco1("dt_ult_desp")),2) & "/" & RIGHT("0" & MONTH(tbbanco1("dt_ult_desp")),2) & "/" & RIGHT("0" & YEAR(tbbanco1("dt_ult_desp")),2) novadata2=RIGHT("0" & DAY(tbbanco1("depo_exec")),2) & "/" & RIGHT("0" & MONTH(tbbanco1("depo_exec")),2) & "/" & RIGHT("0" & YEAR(tbbanco1("depo_exec")),2) novadata3=RIGHT("0" & DAY(tbbanco1("DT_PROVIDENCIA")),2) & "/" & RIGHT("0" & MONTH(tbbanco1("DT_PROVIDENCIA")),2) & "/" & RIGHT("0" & YEAR(tbbanco1("DT_PROVIDENCIA")),2) 'response.Write(novadata) 'response.End()%> <tr bgcolor="#ECF5FF" class="style8"> <td class="style9"><p><%=tbbanco1("processo")%></p></td> <%if tbbanco1("depo_exec")<>"" then%> <td class="style9"><%=novadata2%></td> <%else%> <td class="style9"><%=tbbanco1("depo_exec")%></td> <%end if%> <td class="style9"><%=tbbanco1("marca")%></td> <td class="style9"><a href="listadeclasses.htm" target="_blank" style="text-decoration:none "><%=tbbanco1("classe")%></a></td> <%if tbbanco1("dt_ult_desp")<>"" then%> <td class="style9"><%=novadata%></td> <%else%> <td class="style9"><%=tbbanco1("dt_ult_desp")%></td> <%end if%> <td class="style9"><%=tbbanco1("ult_desp")%></a></td> <td class="style9"><%=tbbanco1("providencia")%></td> <%if tbbanco1("dt_providencia")<>"" then%> <td class="style9"><%=novadata3%></td> <%else%> <td class="style9"><%=tbbanco1("dt_providencia")%></td> <%end if%> <% tbbanco1.movenext wend <% StrSql="Select * from clientes,processos where clientes.acesso='"&codigox&"'" StrSql= StrSql & " and clientes.cadastro=processos.cadastro_proc" StrSql= StrSql & " and processos.obs_import is not null" 'StrSql= StrSql & " and processos.descricao_classe is not null" StrSql= StrSql & " order by processo" set tbBanco2=banco.Execute(strSQL) if not tbbanco2.eof then%> <p align="left" class="style12" style="text-decoration:underline"><img src="seta.gif"><span class="style27">Obs:</span></p> <span class="style27"> <%while not tbbanco2.eof%> </p> </span> <p class="style18"><%=tbbanco2("processo")%> - <%=tbbanco2("obs_import")%></p> <p class="style18"> <% tbbanco2.movenext wend end if tbbanco2.close set tbbanco2=nothing%>%> <% StrSql="Select * from clientes,processos where clientes.acesso='"&codigox&"'" StrSql= StrSql & " and clientes.cadastro=processos.cadastro_proc" StrSql= StrSql & " and processos.descricao_classe is not null" 'StrSql= StrSql & " and processos.descricao_classe is not null" StrSql= StrSql & " order by processo" set tbBanco3=banco.Execute(strSQL)%> <%if not tbbanco3.eof then%> <p align="left" class="style12" style="text-decoration:underline"><img src="seta.gif">Descrição de Classe:</p> </blockquote> <div align="left"> <blockquote> <p class="style30"> <%while not tbbanco3.eof%> </p> <p class="style30"><%=tbbanco3("descricao_classe")%> </p> <p align="left" class="style30"> <% tbbanco3.movenext wend end if tbbanco3.close set tbbanco3=nothing%> %>Como vcs podem ver tem varias consultas com varios loops, ão diferentes partes do codigo...eu rpecisaria otimizar isto pois ta muito lerdo...alguem consegue ajudar??
E ja começando a otimizar preciso trokar o banco de accees pra sql, alguem tem tutoriais de onde baixar o sql e como transferir do acces pro sql???
Brigado!
Carregando comentários...