Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

antonio xavier

como armazenar recordset em textbox

Recommended Posts

eu tinha duas paginas asp: uma com uma consulta que busca cep, endereço e bairro e mostra o resultado na tela e outra pagina que é um formmail com campos solicitante, endereço, cep, etc."juntei estas paginas e criei uma só, onde o cliente consulta o cep e gostaria que fosse armazenado o valor do cep no campo cep do formmail, o campo endereço no campo endereço e assim por diante.consegui armazenar o nome do cliente usando session.armazenei o campo cep usando <%= strSearch %> , mas nao estou conseguindo armazenar o endereço. alguem pode ajudar ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

%><html><head><title>Millenium Express Transportes - Agendamento de entrega</title><meta name="generator" content="Namo WebEditor v5.0(Trial)"><meta name="generator" content="Namo WebEditor v5.0(Trial)"><title>Simulador de configuracoes FORMMAIL</title><meta name="generator" content="Namo WebEditor v5.0(Trial)"><title>ENTREGA AGENDADA</title><meta name="generator" content="Microsoft FrontPage 4.0"></head><body topmargin="0" leftmargin="0" background="../ddd/images/fundo1.gif" bgcolor="#F5F5FA"><table width="715" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F5F5FA" height="58"><tr> <td width="713" height="244"><p align="center"><STRONG><font color="#000033"><FONT color=royalblue face=Tahoma size=2>:: Digite o número do CEP  (sem separador) para consultar </FONT></font><font color="#000033" face="Tahoma" size="2">á</font><FONT color=royalblue face=Tahoma size=2><font color="#000033">rea atendida :</font>:</FONT></STRONG></p> <form action="<%= strURL %>" method="get"> <div align="center"> <input name="search" value="<%= strSearch %>" size="28" /> <input name="submit" type="submit" value="Pesquisar" /> </div> </form> <p align="left"> <%If strSearch <> "" Then ' MapPath of virtual database file path to a physical path. ' If you want you could hard code a physical path here. strDBPath = Server.MapPath("cep.mdb") ' Create an ADO Connection to connect to the sample database. ' We're using OLE DB but you could just as easily use ODBC or a DSN. Set cnnSearch = Server.CreateObject("ADODB.Connection") ' This line is for the Access sample database: cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";" ' We're actually using SQL Server so we use this line instead: 'cnnSearch.Open Application("SQLConnString") ' Build our query based on the input. strSQL = "SELECT rua, cep, bairro " _ & "FROM cep " _ & "WHERE cep LIKE '%" & TiraAcento(Replace(strSearch, "'", "''")) & "%' " _ & "ORDER BY rua;" ' Execute our query using the connection object. It automatically ' creates and returns a recordset which we store in our variable. Set rstSearch = cnnSearch.Execute(strSQL) ' Display a table of the data in the recordset. We loop through the ' recordset displaying the fields from the table and using MoveNext ' to increment to the next record. We stop when we reach EOF. ' For fun I'm combining some fields and showwing you can do more then ' just spit out the data in the form it is in in the table. %> </p> <div align="center"> <table border="0" cellpadding="4" cellspacing="1" width="689" height="1"> <tr> <th bgcolor="#6699CC" width="372" height="1"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: Rua :</font>:</STRONG></FONT></th> <th bgcolor="#6699CC" width="101" height="1"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">::CEP:</font>:</STRONG></FONT></th> <th bgcolor="#6699CC" width="188" height="1"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">::Bairro :</font>:</STRONG></FONT></th> </tr> <td height="1" width="372"> <% Do While Not rstSearch.EOF %></td> <td height="1" width="101"></td> <td height="1" width="188"></td> </tr> <tr> <td bgcolor="#D7F2FF" width="372" height="1"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%= rstSearch.Fields("rua").Value %></font></td> <td bgcolor="#D7F2FF" width="101" height="1"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%= rstSearch.Fields("cep").Value %></font></div></td> <td bgcolor="#D7F2FF" width="188" height="1"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%= rstSearch.Fields("bairro").Value %></font></div></td> </tr> <td height="1" width="372"> <% rstSearch.MoveNext Loop %></td> <td height="1" width="101"></td> <td height="1" width="188"></td> </tr> </table> </div> <% ' Close our recordset and connection and dispose of the objects ' rstSearch.Close ' Set rstSearch = Nothing ' cnnSearch.Close ' Set cnnSearch = NothingEnd If%></td> </tr></table><p> <script Language="JavaScript">function Validator(theForm){ if (theForm.t1Ssolicitante.value == "") { alert("Digite um valor para o campo Empresa solicitante:"); theForm.t1Ssolicitante.focus(); return (false); } if (theForm.t2Ccep.value == "") { alert("Digite um valor para o campo CEP:"); theForm.t2Ccep.focus(); return (false); } if (theForm.t2Cendereço.value == "") { alert("Digite um valor para o campo Endereço:"); theForm.t1Ssolicitante.focus(); return (false); }if (theForm.t2Cnumero.value == "") { alert("Digite um valor para o campo Nº:"); theForm.t2Cnumero.focus(); return (false); }if (theForm.t2Cdestinatario.value == "") { alert("Digite um valor para o campo destinatario:"); theForm.t2Cdestinatario.focus(); return (false); } return (true);}</script> <form method=POST name=Manda onsubmit="return Validator(this)" Action="AGENDAMENTOE.asp"> <div align="center"> <center> <table border=0 width=639 cellspacing=0 cellpadding=0 height="187"> <tr> <td width="176" height="25"><p align="left" style="margin-right: 5"><font color=#000000 face=Verdana size=2><b>Empresa solicitante:</b></font></td> <center> <td width="459" height="25"> <p align="left"><input type=text name=t1Ssolicitante size="50" value=' <%response.write session("Usuario")%> '></td> </tr> <td width="176" height="25"><p align="left" style="margin-right: 5"><font color=#000000 face=Verdana size=2><b>CEP destino:</b></font></td> <center> <td width="459" height="25"><input type=text name=t2Ccep size="12" value="<%= strSearch %>"></td> </tr> <tr> <td width="176" height="25"><p align="left" style="margin-right: 5"><font color=#000000 face=Verdana size=2><b>Endereço destinatário:</b></font></td> <td width="459" height="25"><input type=text name="t2Cendereço" size="50"> <b>nº  </b><input type=text name="t2Cnumero" size="7"></td> </tr> <tr> <td width="176" height="25"><p align="left" style="margin-right: 5"><font color=#000000 face=Verdana size=2><b>Nome destinatário:</b></font></td> <td width="459" height="25"><input type=text name="t2Cdestinatario" size="50"></td> </tr> <tr> <td width="176" height="25"><p align="left" style="margin-right: 5"><font color=#000000 face=Verdana size=2><b>Telefone:</b></font></td> <td width="459" height="25"><input type=text name="t2Ctelefone" size="12"></td> </tr> <tr> <td width="176" height="25"><p align="left" style="margin-right: 5"><font color=#000000 face=Verdana size=2><b>Ramal:</b></font></td> <td width="459" height="25"><input type=text name="t2Cramal" size="12"></td> </tr> <tr> <td width="176" height="27"><p align="left" style="margin-right: 5"><font color=#000000 face=Verdana size=2><b>Departamento:</b></font></td> <td width="459" height="27"><input type=text name="t2Cdepto" size="12">                                                    <input type=submit value=Enviar name=cmdEnvio></td> </tr> <tr> <td width="176" height="25"><p align="left" style="margin-right: 5"><font color=#000000 face=Verdana size=2><b>Comentários:</b></font></td> <td width="459" height="25"><input type=text name="t2Ccomentarios" size="50"></td> </tr> </center></center></center> <tr> <td width="637" colspan=2 height="1"> <p align="right"><font size="2" face="Arial" color="#f08810"><a href="logout.asp">Sair do Sistema</a></font></p> </td> </tr> <center> </table> </div> </form></center></body></html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.