05/06/2012, 09:39
|
| | Fecha de Ingreso: mayo-2012
Mensajes: 18
Antigüedad: 12 años, 6 meses Puntos: 0 | |
Respuesta: Tablas y directorio asp Hola mira lo genere por record set con un html pones un nombre y mi .asp se quedo asi ya te da los nombres de los que busco ahora estoy intentando buscarlos por extencion con otra cajita de texto. Verificando el codigo tengo quer agregar un If pero aun no c bien por donde jajaja.
Muchas gracias
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/conexion.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("nombre") <> "") Then
Recordset1__MMColParam = Request.Form("nombre")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conexion_STRING
Recordset1.Source = "SELECT Nombre, Area, Extension, Email FROM buscame_directorio WHERE Nombre LIKE '%" + Recordset1__MMColParam + "%'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Directorio - Buscame</title>
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es requerido.\n'; }
} if (errors) alert('error:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
<style type="text/css">
<!--
body {
background-color: #ededed;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px; }
.style3 {font-size: 11px; font-family: Verdana, Arial, Helvetica, sans-serif;}
a:link {
color: #FF0000;
text-decoration: underline;
}
a:visited {
text-decoration: underline;
color: #FF0000;
}
a:hover {
text-decoration: none;
color: #FF0000;
}
a:active {
text-decoration: underline;
color: #FF0000;
}
-->
</style></head>
<body onLoad="document.form1.nombre.focus();">
<table width="100%" border="0" cellspacing="10" cellpadding="5" bgcolor="#FFFFFF">
<tr>
<td><img src="media/logo1.gif" width="178" height="68" /></td>
<td><img src="media/spacer.gif" width="20" height="20" /></td>
<td width="100%"><div align="right"><img src="media/logo2.gif" width="169" height="58" /></div></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#666666">
<tr>
<td width="100%"><img src="media/spacer2.gif" width="20" height="5" /></td>
</tr>
</table>
<p> </p>
<table width="90%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#999999" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#CCCCCC"><center spry:hover="style2" class="style2">
Nombre
</center></td>
<td bgcolor="#CCCCCC"><center spry:hover="style2" class="style2">
Área
</center></td>
<td bgcolor="#CCCCCC"><center class="style2">
<p class="style2">Extensión </p>
</center></td>
<td bgcolor="#CCCCCC"><center spry:hover="style2" class="style2">
email
</center></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<tr>
<td class="style3"><%=(Recordset1.Fields.Item("Nombre" ).Value)%></td>
<td class="style3"><%=(Recordset1.Fields.Item("Area"). Value)%></td>
<td class="style3"><%=(Recordset1.Fields.Item("Extensi on").Value)%></td>
<td><a href="mailto:<%=(Recordset1.Fields.Item("Email").V alue)%>"><%=(Recordset1.Fields.Item("Email").Value )%></a></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
<form action="buscador2.asp" method="post" name="form1" id="form1" onsubmit="MM_validateForm('nombre','','R');return document.MM_returnValue">
<blockquote>
<p>
<input name="nombre" type="text" id="nombre" />
<img src="media/spacer.gif" width="20" height="20" />
<input type="submit" name="Submit" value="Buscar" />
</p>
</blockquote>
</form>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%> |