<% wEmpresa=request.item("Empresas") wLetra=request.item("Letra") & "%" Set Conexao = Server.CreateObject("ADODB.Connection") Conexao.Open session("stringconexaobomdesorte") Sql = "SELECT Count(*) as Total FROM TICKETS WHERE CD_EMPRESA = '" & wEmpresa & "'" Set rstempTotal = Conexao.Execute ( Sql ) Sql = "SELECT DISTINCT (C.NOME),C.Cliente, E.NOME AS EMPRESA FROM CLIENTES C LEFT JOIN TICKETS T ON (T.CD_CLIENTE = C.CLIENTE) LEFT JOIN EMPRESAS E ON (E.EMPRESA = T.CD_EMPRESA) WHERE E.EMPRESA = " & wEMPRESA & " AND C.NOME Like '" & wLetra & "' order by C.NOME" Set rstemp = Conexao.Execute ( Sql ) %>

<% If rstemp.eof then%> A empresa não possui clientes cadastrados

ou não possui Nomes iniciados com essa letra.

<% else %>

 

EMPRESA:  <%=rstemp("EMPRESA")%>

 

Total de Clientes <%=rstempTotal("Total")%>

 

Todas     A B C D E F G H I J K L M N O P Q R S T U V X Z Y W 

 

<% While NOT rstemp.EoF %> <% rstemp.MoveNext %> <% Wend %>
Cliente
&Empresa=<%=wEmpresa%>"><%=rstemp("NOME")%>

 

<% END IF %>