Ciao io ho questa pagina:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
set rs=CreateObject("adodb.Recordset")
set rs2=CreateObject("adodb.Recordset")
id_cliente=request.QueryString("id_cliente")
cognome=request.QueryString("cognome")
nome=request.QueryString("nome")
ragione_sociale=request.QueryString("ragione_socia le")
login=request.QueryString("login")
password=request.QueryString("password")
if Request.Form("Submit")="" then
strsql="Select * from CLIENTI where id_cliente=" & id_cliente
'response.Write(strsql)
'response.End()
rs.open strsql, conn
cognome=rs("cognome")
nome=rs("nome")
ragione_sociale=rs("ragione_sociale")
telefono=rs("telefono")
cellulare=rs("cellulare")
email=rs("email")
password=rs("passwd")
login=rs("login")
rs.close
'strsql="Select id_card, titolo, punti From Card"
'rs.open strsql, conn
'titolo=rs("titolo")
'id_card=rs("id_card")
'punti=rs("punti")
'rs.close
%>
<html>
<head>
<title>Alloca - Amministrazione</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../css/01.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Stile1 {color: #000099}
.Stile2 {color: #FF0000}
-->
</style>
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="16%" valign="top"></td>
<td width="84%" valign="top">
<div align="center">
<font size="4" face="Verdana, Arial, Helvetica, sans-serif"><span class="Stile1">ABBINA
LA CARD</span>
</font> </p>
<form method="post" id="form1">
<table width="641" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#C8D6EA">
<tr valign="bottom">
<td width="637" height="61" valign="top"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
<tr class="istruzioni1">
<td><span class="Stile2">Cliente:</span></td>
<td>Cognome:<%=cognome%></td>
<td>Nome:<%=nome%></td>
<td>Rag. Soc. :<%=ragione_sociale%></td>
</tr>
<tr class="istruzioni1">
<td><span class="Stile2">Recapiti:</span></td>
<td>Tel:<%=telefono%></td>
<td>Cell:<%=cellulare%></td>
<td>E-mail:<%=email%></td>
</tr>
</table>
<div align="left"></div></td>
</tr>
<tr valign="bottom">
<td height="31"><font size="2" face="Verdana, Arial, Helvetica, sans-serif" class="percorso">Card Abbinate: </font><font face="Verdana, Arial, Helvetica, sans-serif">
<input type="hidden" name="id_cliente" value="<%=id_cliente%>">
<input type="hidden" name="cognome" value="<%=cognome%>">
<input type="hidden" name="nome" value="<%=nome%>">
<input type="hidden" name="ragione_sociale" value="<%=ragione_sociale%>">
<input type="hidden" name="password" value="<%=password%>">
<input type="hidden" name="login" value="<%=login%>">
</font></td>
</tr>
<tr>
<td>
<%
strsql="Select id_card, titolo, punti From Card"
rs.open strsql, conn
'titolo=rs("titolo")
'id_card=rs("id_card")
'punti=rs("punti")
'rs.close
%>
<table width="100%" border="1" align="left" cellpadding="2" cellspacing="1" bordercolor="#C8D6EA">
<%
do until rs.eof
conta=conta + 1
dataCard=""
attivo=false
%>
<tr bordercolor="#FFFFFF">
<td width="207" class="testo01"><input name="id_card_<%=conta%>" type="checkbox" id="id_card" value="<%=rs("id_card")%>"
<%
strsql="Select id, id_card, attivo, data_acquisto from Clienti_Card where id_cliente=" & id_cliente
rs2.open strsql, conn
do until rs2.eof
if rs("id_card")=rs2("id_card") then
response.Write("checked")
dataCard=rs2("data_acquisto")
attivo=rs2("attivo")
end if
rs2.movenext
loop
%>
>
<%=rs("titolo")%><input type="hidden" name="punti_<%=conta%>" value="<%=rs("punti")%>"></td>
<td width="135" class="testo01">
<input name="attivo_<%=conta%>" type="checkbox" id="attivo" value="<%=rs("id_card")%>"
<%
if attivo=True then response.Write("checked")
rs2.close
%>
>
Attiva </td>
<td width="271" class="testo01"><span class="testo01">Data di acquisto:</span>
<input name="data_acquisto_<%=conta%>" type="text" value="<%if dataCard<>"" then response.Write(dataCard)%>"> </td>
</tr>
<%
rs.movenext
loop
rs.close
%>
</table></td>
</tr>
<tr>
<td height="36"><div align="center"><font face="Verdana, Arial, Helvetica, sans-serif">
<input type="submit" name="Submit" value="Invia">
<input type="button" name="Submit2" value="Indietro" onClick="location.href='cerca_utente.aspx?id_clien te=<%=id_cliente%>&nome=<%=nome%>&cognome=<%=cogno me%>&ragione_sociale=<%=ragione_sociale%>&login=<% =login%>&password=<%=password%>&inizializza=si'">
</font></div></td>
</tr>
</table>
<input type="hidden" name="conta" value="<%=conta%>">
</form>
</div></td>
</tr>
</table>
</body>
</html>
<%
else
conta=request.Form("conta")
'conn.begintrans
for i=1 to conta
' if request.Form("id_card_" & i) <>"" then
'strsql="Delete * From Clienti_Card where id_cliente=" & request.Form("id_cliente") & " and id_card=" & request.Form("id_card_" & i)
strsql="Delete * From Clienti_Card where id_cliente=" & request.Form("id_cliente")
conn.execute strsql
' end if
next
for i=1 to conta
if request.Form("id_card_" & i)<>"" then
strsql="Insert Into Clienti_Card (id_card, punti, id_cliente, data_acquisto) values(" & request.Form("id_card_" & i) & ", " & request.Form("punti_" & i) & ", " & request.Form("id_cliente") & ", #" & request.Form("data_acquisto_" & i) & "#)"
'response.Write(strsql & "
")
'response.End()
conn.execute strsql
end if
next
for i=1 to conta
if request.Form("attivo_" & i)<>"" then
strsql="Update Clienti_Card set attivo=-1 where id_card=" & request.Form("attivo_" & i) & " and id_cliente=" & request.Form("id_cliente")
conn.execute strsql
end if
next
'conn.commitTrans
response.Redirect("add_card.asp?id_cliente=" & request.Form("id_cliente") & "&nome=" & request.Form("nome") & "&cognome=" & request.Form("cognome") & "&ragione_sociale=" & request.Form("ragione_sociale") & "&login=" & request.Form("login") & "&password=" & request.Form("password") )
%>
<%end if
conn.close
%>
Ora il mio problema è chenon mi effettua il primo ciclo dove mi dovrebbe andare a prendere tutte le card, cioè questa parte:
<%
strsql="Select id_card, titolo, punti From Card"
rs.open strsql, conn
'titolo=rs("titolo")
'id_card=rs("id_card")
'punti=rs("punti")
'rs.close
%>
<table width="100%" border="1" align="left" cellpadding="2" cellspacing="1" bordercolor="#C8D6EA">
<%
do until rs.eof
conta=conta + 1
dataCard=""
attivo=false
%>
<tr bordercolor="#FFFFFF">
<td width="207" class="testo01"><input name="id_card_<%=conta%>" type="checkbox" id="id_card" value="<%=rs("id_card")%>"
<%
strsql="Select id, id_card, attivo, data_acquisto from Clienti_Card where id_cliente=" & id_cliente
rs2.open strsql, conn
do until rs2.eof
if rs("id_card")=rs2("id_card") then
response.Write("checked")
dataCard=rs2("data_acquisto")
attivo=rs2("attivo")
end if
rs2.movenext
loop
%>
>
<%=rs("titolo")%><input type="hidden" name="punti_<%=conta%>" value="<%=rs("punti")%>"></td>
<td width="135" class="testo01">
<input name="attivo_<%=conta%>" type="checkbox" id="attivo" value="<%=rs("id_card")%>"
<%
if attivo=True then response.Write("checked")
rs2.close
%>
>
Attiva </td>
<td width="271" class="testo01"><span class="testo01">Data di acquisto:</span>
<input name="data_acquisto_<%=conta%>" type="text" value="<%if dataCard<>"" then response.Write(dataCard)%>"> </td>
</tr>
<%
rs.movenext
loop
rs.close
%>
</table>
ma mi va a prendere solo l'ultimo record, perchè??? dove sbaglio?