<% option explicit %> <% dim cnn dim strSql dim StrSql2 dim nom,cognom,num,pob dim rsAdv dim rsPobl dim primer dim texto Set cnn = Server.CreateObject("ADODB.Connection") cnn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("125adv1029.mdb") nom= Request.Form("TextBoxNom") cognom= Request.Form("TextBoxCognoms") num= Request.Form("TextBoxNumero") pob= Request.Form("DropdownlistPoblaciones") primer = 0 strSql = "Select numcol, nom, cognoms, poblacio, telefon From collegiats " if nom = empty then nom ="" end if if (nom <> "") then strSql = strSql + " Where nom = '" +nom+ "' " primer = 1 end if if (cognom <> "") and (primer = 0) then strSql = strSql + " Where cognoms like '%" + cognom + "%' " primer = "1" else if (cognom <> empty) and (primer = 1) then strSql = strSql + " and cognoms like '%" + cognom + "%' " end if end if if (num <> empty) and (primer = 0) then strSql = strSql + " Where numcol =" + num + " " primer = 1 else if (num <> empty) and (primer = 1) then strSql = strSql + " and numcol =" + num + " " end if end if if ((pob <> "SIN") and (pob <> "")) and (primer = 0) then strSql = strSql + " Where poblacio like '%" + pob + "%' " primer = 1 else if ((pob <> "SIN") and (pob <> "")) and (primer = 1) then strSql = strSql + " and poblacio like '%" + pob + "%' " end if end if strSql = strSql + " order by cognoms " StrSql2 = "Select distinct poblacio from collegiats " set rsAdv = cnn.execute(strSql) set rsPobl = cnn.execute(StrSql2) %> Documento sin título   Tornar
 
Per consultar la Guia Col·legial, completi almenys un dels següents camps: nom, cognoms, el número de col.legiat o escolli una població:

Nom 
Cognoms 
Número de Col.legiat 
Població 

 

<% if rsAdv.EOF then else rsAdv.movefirst end if do while (not rsAdv.EOF) response.Write("") response.Write("") response.Write("") response.Write("") response.Write("") response.Write("") response.Write("") response.write("") rsAdv.movenext loop %>
Advocats
Num. Col·legiat  Cognoms  Nom  Població  Telèfon  FITXA 
" & rsAdv("numcol").value &" " & rsAdv("cognoms").value &" " & rsAdv("nom").value &" " & rsAdv("poblacio").value &" " & rsAdv("telefon").value &"
<% rsAdv.close set rsAdv=nothing %>