
22/09/2004, 10:01
|
| | Fecha de Ingreso: septiembre-2004
Mensajes: 1
Antigüedad: 20 años, 7 meses Puntos: 0 | |
Consulta a BD Buenas quisiera que me ayudaran a consultar un base de dato pero el codigo que utilizo no esta resultando
<%
Resultado = establecer_conexion(Conn)
varNombre = Request.Form("txtNombre")
varLetraRif = Request.Form("cmbLetraRif")
varRif = Request.Form("txtRif")
if varRif <> "" then
varNumeroRif = varLetraRif & varRif
else
varNumeroRif = ""
end if
varBuscar = Request.QueryString("parBuscar")
if varBuscar = "S" then
Set RsResultado = server.CreateObject("ADODB.Recordset")
StrSql = "Select Rif, Nombre"
StrSql = StrSql & " From en_clientes"
if varNumeroRif <> "" then
StrSql = StrSql & " And Rif like ltrim(rtrim('" & varNumeroRif & "'))"
end if
if varNombre <> "" then
StrSql = StrSql & " And Nombre like ltrim(rtrim('" & varNombre & "'))"
end if
if StrSql <> "" then
StrSql = StrSql & " Where " & Left(StrSql,Len(StrSql)-3)
end if
RsResultado.Open StrSql,Conn,adOpenForwardOnly,adLockReadOnly
if Not RsResultado.EOF then
ExistenDatos = "S"
else
strMensaje = "No existen registros, según criterio de busqueda seleccionado."
ExistenDatos = "N"
end if
end if
%>
<script>
function BuscarDatos(theForm)
{
theForm.target = '_top';
theForm.action = "UUClientesModificar.asp?parBuscar=S";
theForm.submit();
return true;
}
</script>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<LINK rel="stylesheet" type="text/css" href="../Style/Style.css">
</HEAD>
<BODY topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<form name="ModificarClientes" method="post" onsubmit="return Buscar_Datos(document.ModificarClientes);">
<input type="hidden" name="parBuscar" value="S">
<!-- #include file='../inc/CabeceraMenu.asp' -->
<br>
<table width="70%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="CabeceraTitulos" align="left">
Modificar Datos Del Cliente
</td>
</tr>
</table>
<br>
<table border="0" width="70%" cellpadding="1" cellspacing="2">
<tr>
<td class="CabeceraCampos" width="30%" align="left">
<strong>Nombre:</strong>
</td>
<td class="CabeceraCampos" width="30%" align="left">
<strong>Rif:</strong>
</td>
<td rowspan="2" width="30%" align="center">
<input type="button" name="btnBuscar" value="Buscar" onclick="BuscarDatos(document.ModificarClientes);" style="WIDTH:70; BACKGROUND-COLOR: #364C94; CURSOR: hand; COLOR: white; border='#CFD7E7 1pt solid';this.style.color='white'" onmouseover="this.style.background='#CFD7E7'; style.border='1 solid #364C94';this.style.color='black';" onmouseout="style.border='1 solid #CFD7E7'; this.style.background='#364C94';this.style.color=' white'">
</td>
</tr>
<tr>
<td align="left">
<input type="text" name="txtNombre" size="30%">
</td>
<td align="left">
<%LetraRif(varLetraRif)%><input type="text" name="txtRif">
</td>
</tr>
</table>
<br><br>
<%if varBuscar = "S" then%>
<table border="0" width="70%" cellpadding="1" cellspacing="2">
<tr>
<td width="30%" class="CabeceraCampos" align="center">
<strong>Rif</strong>
</td>
<td width="30%" class="CabeceraCampos" align="center">
<strong>Nombre</strong>
</td>
<td width="30%" class="CabeceraCampos" align="center">
<strong>Acción</strong>
</td>
</tr>
<%
Do While Not RsResultado.EOF
Response.Write("<tr>")
Response.Write("<td align=""left"" width=""230"">")
if RsResultado("Rif") <> "" then
Response.Write("<font size=""1"" face=""Arial""><strong> " & RsResultado("Rif") & "</strong></font>")
else
Response.Write("<font size=""1"" face=""Arial""><strong> </strong></font>")
end if
Response.Write("</td>")
Response.Write("<td align=""left"" width=""230"">")
if RsResultado("Nombre") <> "" then
Response.Write("<font size=""1"" face=""Arial""><strong> " & RsResultado("Nombre") & "</strong></font>")
else
Response.Write("<font size=""1"" face=""Arial""><strong> </strong></font>")
end if
Response.Write("</td>")
Response.Write("</tr>")
RsResultado.MoveNext
'Posicion = Posicion + 1
Loop
RsResultado.Close
Set RsResultado = Nothing
Response.Write("</table>")
if ExistenDatos = "S" then%>
<tr>
<td colspan="3" class="CabeceraCampos" align="center">
<%=strMensaje%>
</td>
</tr>
<%else%>
<%end if%>
<%end if%>
</form>
</BODY>
</HTML>
<% cerrar_conexion(Conn)%> |