473,386 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

update on check


hi
i need to update an SQL Table when user select or unselect a checkbox
control.
How Can i do?
Thanks
Alex

Aug 22 '05 #1
5 2332
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"
Aug 22 '05 #2

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"


Aug 22 '05 #3
www.aspfaq.com/5006

Bob Barrows
A.Dagostino wrote:
the table is a MS SQL Server table.
What version of SQL Server?
here is the script
<% You misunderstood what I meant by a "CREATE TABLE" script. Please go to the
link I provided and read the article:
www.aspfaq.com/5006
Also, I noticed an onclick event procedure containing some code to create a
sql statement. Does this imply that you want to perform this update from
client-side code without submitting your form? If so, this is not an ASP
issue and you should provide the information I requested in a post to a more
relevant newsgroup like microsoft.public.scripting.vbscript

Bob Barrows

"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
(). 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. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Aug 22 '05 #4

ok i try to explain you my problem from the begin.
I have a page whith n articles loaded in an html table.
Now users can select only one article.
I need to permit a multiselction to the users.
So, if i can't modify the original template I have Created a window whit
the articles and checkbox controls. Now i need to give the result of the
selection to anaother page.

How can i do?
P.S i'm not very espert of web applications
Thanks
Alex
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> ha scritto nel messaggio
news:%2****************@TK2MSFTNGP15.phx.gbl...

www.aspfaq.com/5006

Bob Barrows
A.Dagostino wrote:
the table is a MS SQL Server table.


What version of SQL Server?
here is the script
<%

You misunderstood what I meant by a "CREATE TABLE" script. Please go to
the
link I provided and read the article:
www.aspfaq.com/5006


Also, I noticed an onclick event procedure containing some code to create
a
sql statement. Does this imply that you want to perform this update from
client-side code without submitting your form? If so, this is not an ASP
issue and you should provide the information I requested in a post to a
more
relevant newsgroup like microsoft.public.scripting.vbscript

Bob Barrows

"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
(). 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. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Aug 23 '05 #5
You're telling me everything except what I asked for: I need to know about
your database. I need to know about the columns in your database table (not
all of them - just the relevant ones - the primary key, the field that will
contain the data controlled by the checkbox). Not just their names ... I
need to know their datatypes. Again, the best way to convey that information
can be found in www.aspfaq.com/5006.

From your description, it no longer sounds as if you need a client-side
solution, so we will continue this discussion here. Please provide the
information requested in my first paragraph so I can begin to help you.

Also, I need to know what you want the application to do after the user
clicks the checkboxes in your html table. It is easy enogh to process the
multiple checkbox selections in another page ... I just need to know what
you want that page to do with the records that were selected.

Here is a quick generic demonstration:

page1.htm:

<html><body>
<form method="post" action="page2.asp">
<table>
<tr>
<td>
<input type="text" value="First record" name="data1">
</td>
<td>
<input type="checkbox" name="selector" value="1">
</td>
</tr>
<tr>
<td>
<input type="text" value="Second record" name="data2">
</td>
<td>
<input type="checkbox" name="selector" value="2">
</td>
</tr>
<tr>
<td>
<input type="text" value="Third record" name="data3">
</td>
<td>
<input type="checkbox" name="selector" value="3">
</td>
</tr>
</table>
<input type="submit" value="Submit">
</form>
</body></html>
page2.asp:

<%
dim key
Response.write "Here is all the data submitted by the form:<BR>"
for each key in Request.Form
Response.Write key & ": " & Request.Form(key) & "<BR>"
next

dim selected
selected=request.form("selector")
Response.write "<BR>The following records were selected:<BR>"
Response.write selected & "<BR><BR>"
Response.write "Here is where I process the selections:<BR>"
dim ar, i, id, data
if len(selected) > 0 then
response.write "<table border=""1""><tr><th colspan=""2"">"
response.write "Selected Data" & "</th></tr>"
ar=split(selected,",")
for i = 0 to ubound(ar)
id=trim(ar(i))
data = request.form("data" & id)
ar(i)="<tr><td>" & id & "</td><td>" & data & "</td></tr>"
next
response.write join(ar,vbcrlf)
response.write "</table>"
else
response.write "No records were selected"
end if
%>

Bob Barrows
A.Dagostino wrote:
ok i try to explain you my problem from the begin.
I have a page whith n articles loaded in an html table.
Now users can select only one article.
I need to permit a multiselction to the users.
So, if i can't modify the original template I have Created a window
whit the articles and checkbox controls. Now i need to give the
result of the selection to anaother page.

How can i do?
P.S i'm not very espert of web applications
Thanks
Alex
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> ha scritto nel
messaggio news:%2****************@TK2MSFTNGP15.phx.gbl...

www.aspfaq.com/5006

Bob Barrows
A.Dagostino wrote:
the table is a MS SQL Server table.


What version of SQL Server?
here is the script
<%

You misunderstood what I meant by a "CREATE TABLE" script. Please go
to the
link I provided and read the article:
www.aspfaq.com/5006


Also, I noticed an onclick event procedure containing some code to
create a
sql statement. Does this imply that you want to perform this update
from client-side code without submitting your form? If so, this is
not an ASP issue and you should provide the information I requested
in a post to a more
relevant newsgroup like microsoft.public.scripting.vbscript

Bob Barrows

"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
(). 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. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.


--
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"
Aug 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Karaoke Prince | last post by:
Hi There, I have an update statement to update a field of a table (~15,000,000 records). It took me around 3 hours to finish 2 weeks ago. After that no one touched the server and no...
2
by: joo | last post by:
Hi! I need to implement something similar to "Automatic Update" feature which we see in windows 2000. We need this support for our software, basically to provide the software update. How can I...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
2
by: aaj | last post by:
Hi all I have a continuous bound form and on each record is a tick box. The user ticks the boxes and these boxes define the batch. for future operations before they leave the page I count...
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
15
by: graham | last post by:
Hi all, <bitching and moaning section> I am asking for any help I can get here... I am at the end of my tether... I don;t consider myself a genius in any way whatsoever, but I do believe I have...
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
5
by: Stephen Plotnick | last post by:
I'm very new to VB.NET 2003 Here is what I have accomplished: MainSelectForm - Selects an item In a public class I pass a DataViewRow to ItemInformation1 Form ItemInformation2 Form
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
6
by: Suresh | last post by:
Hi All, I am fetching a dataset from the database under some condition. After this I create a data table. Traverse in the original dataset & add each row to created data table as it is through...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.