Passare i dati da una select ad un'altra

sabato 12 maggio 2012 - 16.11
Tag Elenco Tags  Access (.mdb)  |  VBScript

Alasque Profilo | Newbie

ciao a tutti,

non riesco a passare i dati di un'unica tabella da una select ad un'altra:

riporto lo script:

<%
Dim rsRegioni
Dim rsRegioni_cmd
Dim rsRegioni_numRows

Set rsRegioni_cmd = Server.CreateObject ("ADODB.Command")
rsRegioni_cmd.ActiveConnection = MM_Agenti_STRING
rsRegioni_cmd.CommandText = "SELECT distinct reg FROM Province"
rsRegioni_cmd.Prepared = true

Set rsRegioni = rsRegioni_cmd.Execute
rsRegioni_numRows = 0
%>
<%
Dim rsProvince__Param1
rsProvince__Param1 = "-1"
If (Request("Reg") <> "") Then
rsProvince__Param1 = Request("Reg")
End If
%>
<%
Dim rsProvince
Dim rsProvince_cmd
Dim rsProvince_numRows

Set rsProvince_cmd = Server.CreateObject ("ADODB.Command")
rsProvince_cmd.ActiveConnection = MM_Agenti_STRING
rsProvince_cmd.CommandText = "SELECT distinct Pr_des FROM Province where reg = ?"
rsProvince_cmd.Prepared = true
rsProvince_cmd.Parameters.Append rsProvince_cmd.CreateParameter("param1", 200, 1, 255, rsProvince__Param1) ' adVarChar

Set rsProvince = rsProvince_cmd.Execute
rsProvince_numRows = 0
%>
--- --- --- --- ---

<form id="form1" name="form1" method="post" action="a_modulo__cms.asp">
<div align="center">
<label> <span class="Stile1 Stile34">
<input name="MM_Procedi" type="hidden" id="MM_Procedi" value="true" />
<select name="Reg" id="Reg" onchange="MM_goToURL('parent','a_modulo__cms.asp?Reg=' + this.options[this.selectedIndex].value + '');return document.MM_returnValue">
<option value="-1" <%If (Not isNull(Request("Reg"))) Then If ("-1" = CStr(Request("Reg"))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Scegli la Regione</option>
<%
While (NOT rsRegioni.EOF)
%>
<option value="<%=(rsRegioni.Fields.Item("Reg").Value)%>" <%If (Not isNull(Request("Reg"))) Then If (CStr(rsRegioni.Fields.Item("Reg").Value) = CStr(Request("Reg"))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsRegioni.Fields.Item("Reg").Value)%></option>
<%
rsRegioni.MoveNext()
Wend
If (rsRegioni.CursorType > 0) Then
rsRegioni.MoveFirst
Else
rsRegioni.Requery
End If
%>
</select>
</label>
</div>
</tr>
<tr>
<td height="25" bordercolor="#FAF8F8" bgcolor="#CCCCCC"><div align="right" class="Stile38 Stile45 Stile84">
<div align="right">Provincia</div>
</div></td>
<td colspan="4" bgcolor="#FAF8F8"><div align="left" class="Stile84">
<div align="left"> <span class="Stile74">
<label></label>
</span>
<label></label>
<label></label>
<select name="Pr_Des" id="Pr_Des" onchange="MM_goToURL('parent','a_modulo__cms.asp?Reg=<%=Server.URLEncode(Request("Reg"))%>&Pr_Des=<%=Server.URLEncode(Request("Pr_Des"))%>&Pr_Des=' + this.options[this.selectedIndex].value + '');return document.MM_returnValue">
<option value="-1" <%If (Not isNull(Request("Pr_Des"))) Then If ("-1" = CStr(Request("Pr_Des"))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Scegli la Provincia</option>
<%
While (NOT rsProvince.EOF)
%>
<option value="<%=(rsProvince.Fields.Item("Pr_Des").Value)%>" <%If (Not isNull(Request("Pr_Des"))) Then If (CStr(rsProvince.Fields.Item("Pr_Des").Value) = CStr(Request("Pr_Des"))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(rsProvince.Fields.Item("Pr_Des").Value)%></option>
<%
rsProvince.MoveNext()
Wend
If (rsProvince.CursorType > 0) Then
rsProvince.MoveFirst
Else
rsProvince.Requery
End If
%>
</select>
</form>

grazie
Alasque
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2017
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5