Ir para conteúdo
Fórum Script Brasil
  • 0

(Resolvido) Apenas em uma das combos os dados são carregados.


Martinsrj

Pergunta

:unsure:

Ola pessoal, boa tarde!

Estou com grande dificuldade em carregar na segundo combo os dados, aparece apenas o ultimo dado cadastro no banco tres vezes.

Postei o meu codigo no pastebin para uma melkhor visualizacao: http://pastebin.com/f72501d99

Aqui segue o codigo da minha pagina:

<%
Option Explicit
Response.Charset="ISO-8859-1"
Response.AddHeader "Content-Type", "text/html; charset=iso-8859-1"
%>
<!--#Include file="conexao.asp"-->
<%
Dim conbd_gd, rsDados, rsDados2, strSQL, strSQL2, var_nomeprojeto, var_cod_dados, rs_Dados
strSQL = "SELECT * FROM tab_dadosprojeto"
strSQL = strSQL & " order by data desc"

strSQL2 = "SELECT * FROM tab_dadosprojeto"
strSQL2 = strSQL2 & " order by data desc"
Call AbreConexao

Set rsDados = conbd_gd.Execute(strSQL)
Set rsDados2 = conbd_gd.Execute(strSQL2)

var_cod_dados = rsDados2("cod_dados")
var_nomeprojeto = rsDados2("nome_projeto")


%>
<!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=utf-8" />
<title>Gerência de Serviços de TI</title>

<link href="../estilos_portabilidade.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
body {
    margin-left: 0px;
}

-->
</style></head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="50" bgcolor="#CC0000">&nbsp;<span class="style1200">&nbsp;PROJETOS</span></td>
    <td bgcolor="#CC0000"><div align="right"><a href="java script:window.close()"><img src="../menu/quadrinho.gif" width="17" height="17" border="0" /></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td valign="top" bgcolor="#FFFFFF"><div align="center"> <br />
            <br />
        <table width="98%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="20"><span class="style2">Inclusão das Decrições de Atividades</span></td>
              </tr>
            </table>
      <br />
        <table width="99%" border="0" cellspacing="0" cellpadding="0">
              <form>
                <tr>
                  <td valign="top"><table width="100%" border="0" cellspacing="5" cellpadding="0">
                      <tr>
                        <td height="35" bgcolor="f4f4f4" class="style3">&nbsp;</td>
                        <td bgcolor="f4f4f4">
<select name="txt_codprojeto" size="1" >
<option>Codigo do Projeto: </option>

<% Do While Not rsDados.Eof %> 
<option value="<% = rsDados("cod_dados")%>">
<%=rsDados("cod_dados")%> 
</option>
<%
rsDados.MoveNext
LOOP%> 
</select> 
<%
Set rsDados=nothing 
'rsDados.Close
'Call FechaConexao
%>

<select name="txt_nomeprojeto" size="1" >
<option>não sabe o codigo, clique aqui: </option>

<% Do While Not rsDados2.Eof %> 
<option value="<% = var_cod_dados %>">
<%= var_cod_dados %> - <%= var_nomeprojeto %> 
</option>
<%
rsDados2.MoveNext
LOOP%> 
</select>
<%
Set rsDados2=nothing 
'rsDados2.Close
'Call FechaConexao
%>
                        
                        </td>
                      </tr>
                      <tr>
                        <td width="18%" height="35" bgcolor="f4f4f4" class="style3"><div align="right">Ação:</div></td>
                        <td width="82%" bgcolor="f4f4f4"><label></label>
                        <textarea name="txt_acao" id="txt_acao" cols="90" rows="2" class="campocombo"></textarea>
                        </td>
                      </tr>
                      <tr>
                        <td height="35" bgcolor="f4f4f4" class="style3"><div align="right">Status:</div></td>
                        <td bgcolor="f4f4f4"><label>
                        <select name="txt_status" size"1">
                            <option>Escolher Status</option>
                            <option>Concluído</option>
                            <option>Em andamento - Atenção</option>
                            <option>Em andamento - Crítico</option>
                            <option>Em andamento - Normal</option>
                            <option>Não Iniciado</option>
                            <option>On-going</option>
                          </select>
                        </label></td>
                      </tr>
                      <tr>
                        <td height="35" bgcolor="f4f4f4" class="style3"><div align="right">Responsável:</div></td>
                        <td bgcolor="f4f4f4"><input name="txt_responsavel" type="text" class="campocombo" id="txt_prod" size="40" /></td>
                      </tr>
                      <tr>
                        <td height="35" bgcolor="f4f4f4" class="style3"><div align="right">Data:</div></td>
                        <td bgcolor="f4f4f4"><select name="date_dia" id="text_data">
                            <option>Dia</option>
                          <option value="01">01</option>
                          <option value="02">02</option>
                          <option value="03">03</option>
                          <option value="04">04</option>
                          <option value="05">05</option>
                          <option value="06">06</option>
                          <option value="07">07</option>
                          <option value="08">08</option>
                          <option value="09">09</option>
                          <option value="10">10</option>
                          <option value="11">11</option>
                          <option value="12">12</option>
                          <option value="13">13</option>
                          <option value="14">14</option>
                          <option value="15">15</option>
                          <option value="16">16</option>
                          <option value="17">17</option>
                          <option value="18">18</option>
                          <option value="19">19</option>
                          <option value="20">20</option>
                          <option value="21">21</option>
                          <option value="22">22</option>
                          <option value="23">23</option>
                          <option value="24">24</option>
                          <option value="25">25</option>
                          <option value="26">26</option>
                          <option value="27">27</option>
                          <option value="28">28</option>
                          <option value="29">29</option>
                          <option value="30">30</option>
                          <option value="31">31</option>
                          </select>
                            <label>
                            <select name="date_mes" id="select2">
                              <option>Mês</option>
                              <option value="jan">01</option>
                              <option value="fev">02</option>
                              <option value="mar">03</option>
                              <option value="abr">04</option>
                              <option value="mai">05</option>
                              <option value="jun">06</option>
                              <option value="jul">07</option>
                              <option value="ago">08</option>
                              <option value="set">09</option>
                              <option value="out">10</option>
                              <option value="nov">11</option>
                              <option value="dez">12</option>
                            </select>
                            <select name="date_ano" id="select3">
                              <option>Ano</option>
                              <option value="2009">2009</option>
                              <option value="2010">2010</option>
                              <option value="2011">2011</option>
                              <option value="2012">2012</option>
                                                        </select>
                        </label></td>
                      </tr>
                      <tr>
                        <td height="50" bgcolor="f4f4f4">&nbsp;</td>
                        <td bgcolor="f4f4f4"><label>
                        <input type="submit" name="btEnviar" id="btEnviar" class="botao" value="Cadastrar" />
                        <input type="reset" name="btLimpa" id="btLimpa" class="botao" value="Limpar" />
                        </label></td>
                      </tr>
                  </table></td>
                </tr>
              </form>
        </table>
            <br />
            <br />
        <br />
    </div></td>
  </tr>
</table>
</body>
</html>

Veja como os dados aparece na segunda combo:

2ff4bd872660a73e7b13c9975d93ce3c.jpg

Uma observacao: a segunda combo so serve como cola para o usuario inserir na primeira combo qual e o codigo do seu projeto.

a segundo combo de aparecer o codigo juntamente com o nome do projeto, a primeira so aparece o codigo.

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0

Resolvido da seguinte forma:

<td bgcolor="f4f4f4">
<select name="txt_codprojeto" size="1" >
<option>Codigo do Projeto: </option>

<% Do While Not rsDados.Eof %> 
<option value="<% = rsDados("cod_dados")%>">
<%=rsDados("cod_dados")%> 
</option>
<%
rsDados.MoveNext
LOOP%> 
</select> 
<%
Set rsDados=nothing 
'rsDados.Close
'Call FechaConexao
%>

<select name="txt_nomeprojeto" size="1" >
<option>não sabe o codigo, clique aqui: </option>
<% Do While Not rsDados2.Eof %>
<option value="<% = rsDados2("cod_dados") %>">
<%= rsDados2("cod_dados") %> - <%= rsDados2("nome_projeto") %> 
</option>
<%
rsDados2.MoveNext
LOOP%> 
</select>
<%
Set rsDados2=nothing 
'rsDados2.Close
'Call FechaConexao
%>
                        
                        </td>

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.


  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,5k
×
×
  • Criar Novo...