Visualizzazione dei risultati da 1 a 3 su 3

Discussione: select combinata

  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    583

    select combinata

    Vi ripropongo questa query con una select ke dovrebbe diventare combinata





    <select size="1" name="c" style="font-size: 8 pt; font-family: Tahoma; background-color: #FFFFFF; color: #0066CC; border-style: solid; border-width: 1">

    <option value="">MARCA</option>
    <%
    Set Con = Server.CreateObject("ADODB.Connection")
    Set rsQuery = Server.CreateObject("ADODB.Recordset")
    Path = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    Path = Path & Server.MapPath("public/database.mdb")
    Con.Open Path
    Set rs = Con.Execute("select c from tabella1 where accesso = 'SI' and tipologia like 'NUOVO%' group by c order by c Asc")
    while rs.eof = false
    %>

    <option value="<%=Rs(0)%>"><%=Rs(0)%></option>
    <%
    rs.MoveNext()
    wend
    rs.close
    con.close
    %>

    </select>


    </td>
    <td width="80">


    <select size="1" name="a" style="font-size: 8 pt; font-family: Tahoma; background-color: #FFFFFF; color: #0066CC; border-style: solid; border-width: 1">

    <option value="">MODELLO</option>
    <%
    Set Con = Server.CreateObject("ADODB.Connection")
    Set rsQuery = Server.CreateObject("ADODB.Recordset")
    Path = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    Path = Path & Server.MapPath("public/database.mdb")
    Con.Open Path
    Set rs = Con.Execute("select a from tabella1 where accesso = 'SI' and tipologia like 'NUOVO%' group by a order by a Asc")
    while rs.eof = false
    %>

    <option value="<%=Rs(0)%>"><%=Rs(0)%></option>
    <%
    rs.MoveNext()
    wend
    rs.close
    con.close
    %>



    </select>



    </td>
    <td width="80">



    <select size="1" name="b" style="font-size: 8 pt; font-family: Tahoma; background-color: #FFFFFF; color: #0066CC; border-style: solid; border-width: 1">

    <option value="">ANNO</option>
    <%
    Set Con = Server.CreateObject("ADODB.Connection")
    Set rsQuery = Server.CreateObject("ADODB.Recordset")
    Path = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    Path = Path & Server.MapPath("public/database.mdb")
    Con.Open Path
    Set rs = Con.Execute("select b from tabella1 where accesso = 'SI' and tipologia like 'NUOVO%' group by b order by b Asc")
    while rs.eof = false
    %>

    <option value="<%=Rs(0)%>"><%=Rs(0)%></option>
    <%
    rs.MoveNext()
    wend
    rs.close
    con.close
    %>



    </select>


    dove i campi MODELLI e ANNO variano come valori in base alla MARCA cioè alla prima select

    marca, modello, anno sono 3 campi del db naturalmente

    come può essere modificato tutto questo

    fatemi sapere grazie

  2. #2
    cercati "select dinamiche" nel forum
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  3. #3
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    583
    Bene sto provando cosi



    <select size="1" name="c" style="font-size: 8 pt; font-family: Tahoma; background-color: #FFFFFF; color: #0066CC; border-style: solid; border-width: 1">

    <option value="">MARCA</option>
    <%
    Set Con = Server.CreateObject("ADODB.Connection")
    Set rsQuery = Server.CreateObject("ADODB.Recordset")
    Path = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    Path = Path & Server.MapPath("public/database.mdb")
    Con.Open Path
    Set rs = Con.Execute("select c from tabella1 where accesso = 'SI' and tipologia like 'NUOVO%' group by c order by c Asc")
    while rs.eof = false
    %>

    <option value="<%=Rs(0)%>"><%=Rs(0)%></option>
    <%
    rs.MoveNext()
    wend
    rs.close
    con.close
    %>

    </select>



    <%
    ' SECONDA QUERY PER LA SELECT a
    strSql = "SELECT a FROM tabella1 GROUP BY a ORDER BY a ASC"
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open strSql, Conn, 3, 3
    %>

    <select name=a onChange="window.document.location='page.asp?c=<%= c_sel%>&a='+this.options[this.selectedIndex].value;">

    <% a_sel = request.querystring("a") %>
    <% if a_sel <> "" then %>
    <option value="<%=a_sel%>" selected="selected"><%=a_sel%></option>
    <% else %>
    <option selected>Seleziona valore</option>

    <%
    end if

    If Not RS.EOF Then
    Do While Not RS.EOF
    %>
    <option value= "<% = Trim(RS("a")) %>"><% = Trim(RS("a")) %></option>
    <%
    RS.MoveNext
    Loop
    End If
    RS.Close
    %>
    </select>

    <%
    ' TERZA QUERY PER LA SELECT b
    strSql = "SELECT b FROM tabella1 GROUP BY b ORDER BY b ASC"
    Set RS = Server.CreateObject("ADODB.Recordset")
    RS.Open strSql, Conn, 3, 3
    %>

    <select name=b onChange="window.document.location='page.asp?c=<%= c_sel%>&a=<%=a_sel%>&b='+this.options[this.selectedIndex].value;">

    <% b_sel = request.querystring("b") %>
    <% if b_sel <> "" then %>
    <option value="<%=b_sel%>" selected="selected"><%=b_sel%></option>
    <% else %>
    <option selected>Seleziona valore</option>

    <%
    end if

    If Not RS.EOF Then
    Do While Not RS.EOF
    %>
    <option value= "<% = Trim(RS("b")) %>"><% = Trim(RS("b")) %></option>
    <%
    RS.MoveNext
    Loop
    End If
    RS.Close
    %>
    </select>


    mi da questo errore


    ADODB.Recordset error '800a0bb9'

    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

    /nuovo1.asp, line 363




    cosa devo modificare
    fammi sapere

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.