Forums

ASP

This topic is locked

SQL Update

Posted 22 Jun 2001 13:51:01
1
has voted
22 Jun 2001 13:51:01 gianluca jean posted:
I want update more field, I have used one page where I take the value of ID by checkbox and another page where run the SQL to update the Yes/no field
I don't understand, but I receive a sintax error on sql stantement
thanks to all

this is the code of update page

<% dim num
dim xide
dim whr
dim sql
whr=""
xide=split(request.querystring("checkbox",",",-1,1)
for each num in xide
if whr<>"" then whr=whr & " or "
whr=whr & "ID=" & num
next
sql="UPDATE T_attivita SET T_attivita.vedi = No WHERE "
sql=sql & whr
%>
<%

set Command1 = Server.CreateObject("ADODB.Command"
Command1.ActiveConnection = MM_biblio1_STRING
Command1.CommandText = sql
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

%>




Replies

Replied 24 Jun 2001 16:26:00
24 Jun 2001 16:26:00 Joel Martinez replied:
hmmm... instead of trying to build the SQL
string... just use the comma delimited
request info.. like this:
-----------------
sql = "UPDATE T_attivita SET T_attivita.vedi = No WHERE ID IN ("& request.querystring("checkbox" &""
------------------
the resulting SQL statement will turn out like this

UPDATE T_attivita SET T_attivita.vedi = No WHERE ID IN (1,4,2,7,23,45)

Hope it helps,
Joel Martinez

----------
Is this thing on?....
Replied 25 Jun 2001 16:05:34
25 Jun 2001 16:05:34 gianluca jean replied:
Thanks
now run

Reply to this topic