the table is a MS SQL Server table
here is the script
<%
'I LOAD A TABLE WITH THE COLUMNS AND A CHECKBOX
response.expires = 0
dim sql, rs
set rs = createObject("ADODB.recordset")
rs.open "USE At_Wrk_Db SELECT IdArticolo, MGAA_MBIV_Id, MGAA_MBDC_Classe,
MGAA_Matricola, descrizione, Statoarticolo, selezione FROM
WRK_ListaArticoli",connessioneDB, 3, 3
response.Write("<input type=""button"" value=""Chiudi finestra""
name=""CloseWin"" onclick=""javascript
:chiudifinestra();""</button></td>")
response.write "<table cellspacing=""3"" cellpadding=""2"" border=""1""
rules=""groups"" frame=""borders"" bordercolor=""#cococo""
style=""behavior:url(tabEdit.htm)"" slcolor=silver hlcolor=black>"
'response.write "<table border='1'>"
while not rs.eof
'response.write "<tr style=""cursor: hand;""
onclick=""selectSeekRow(this);"""
response.write "<tr>"
response.write "<td>" & rs("IDarticolo") & "</td>"
response.write "<td>" & rs("MGAA_MBIV_Id") & "</TD>"
'response.write "><td style=""padding-left:3px;border-bottom:1px solid
black;border-right:1px solid black""><font size=""1"">"
response.write "<td>" & rs("MGAA_MBDC_Classe") & "</td>" '&
"</font></td><td style=""border-right:1px solid black;border-bottom:1px
solid black;"">"
response.write "<td>" & rs("MGAA_Matricola") & "</td>" '& "</td><td
style=""padding-left:5px;border-bottom:1px solid black;"">"
response.write "<td>" & rs("descrizione") & "</td>"
style=""border-bottom:1px solid black;"">" & posizione &" </td>"
'I CALL A VBSCRIPT SUB(WHITH PARAMETERS) WHEN THE ONCLICK EVENT IS ACTIVATE
response.write "<td><input type='checkbox' name='ChkSelezione'
onclick=""ChkSelezione_onClick(this.checked," & rs("MGAA_Matricola") &
");""></td>"
response.write "</tr>"
rs.movenext
wend
response.write "</table>"
%>
HERE IS THE SUB
Sub ChkSelezione_onClick(Check, Matricola)
dim Sql_Aggiorna_Sel, bit, rs
//msgbox (chek & " " & Matricola)
if check=true then
bit=1
else
bit=0
End if
Sql_Aggiorna_Sel= "USE At_Wrk_Db UPDATE WRK_ListaArticoli SET Selezione =" &
bit & " WHERE MGAA_Matricola=" & "'" & matricola & "'"
connessioneDB.execute(Sql_Aggiorna_Sel)
end sub
* connessioneDB is defined in the GLOBAL.ASA it seems to be Protected.
thanks for your help
Alex
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> ha scritto nel messaggio
news:ex**************@TK2MSFTNGP09.phx.gbl...
A.Dagostino wrote: hi
i need to update an SQL Table when user select or unselect a checkbox
control.
How Can i do?
Thanks
Alex
Database type and version, please. "SQL Table" may mean "MS SQL Server",
but it does not have to ...
Also, please provide some information about the table. It would really
help if you provided the CREATE TABLE script for the table
(www.aspfaq.com/5006). Just show the relevant columns.
And give us a little information about the form you are using. Are you
using POST or GET? What is the name of the checkbox? Are you submitting it
to itself or to another page?
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"