Updating multiple records thru checkbox
am 10.01.2005 06:34:59 von A P
Hi!
I've been modifying the script that I see on the internet that will
transform from DELETE query to UPDATE:
DELETE QUERY
strIDs = Replace(Request.Form, "&del=", ",")
strIDs = Replace(strIDs, "del=", "")
set conn= Server.CreateObject("ADODB.Connection")
conn.open "FileDSN=sample.dsn"
set DoDelete = Server.CreateObject("ADODB.Command")
DoDelete.ActiveConnection = conn
DoDelete.CommandText = "DELETE FROM tblMarkMain WHERE ID IN (" & strIDs &
")"
DoDelete.CommandType = 1
DoDelete.CommandTimeout = 0
DoDelete.Prepared = true
DoDelete.Execute()
This script works on DELETE QUERY but when I change the CommandText to
update:
"UPDATE tblMarkMain SET batch='" & Request.Form("txtbatch") & "' WHERE ID IN
(" & strIDs & ")"
it doesn't work. I receive too few parameters. I have checked the syntax of
UPDATE and I didn't see the this line as its standard syntax. Can you help?
Re: Updating multiple records thru checkbox
am 10.01.2005 12:32:53 von jeff.nospam
On Mon, 10 Jan 2005 13:34:59 +0800, "A P" wrote:
>Hi!
>
>I've been modifying the script that I see on the internet that will
>transform from DELETE query to UPDATE:
>
>DELETE QUERY
>
>strIDs = Replace(Request.Form, "&del=", ",")
>strIDs = Replace(strIDs, "del=", "")
>
>set conn= Server.CreateObject("ADODB.Connection")
>conn.open "FileDSN=sample.dsn"
>set DoDelete = Server.CreateObject("ADODB.Command")
>DoDelete.ActiveConnection = conn
>DoDelete.CommandText = "DELETE FROM tblMarkMain WHERE ID IN (" & strIDs &
>")"
>DoDelete.CommandType = 1
>DoDelete.CommandTimeout = 0
>DoDelete.Prepared = true
>DoDelete.Execute()
>
>This script works on DELETE QUERY but when I change the CommandText to
>update:
>
>"UPDATE tblMarkMain SET batch='" & Request.Form("txtbatch") & "' WHERE ID IN
>(" & strIDs & ")"
>
>it doesn't work. I receive too few parameters. I have checked the syntax of
>UPDATE and I didn't see the this line as its standard syntax. Can you help?
Tell us the database you use and do a Response.Write of your query to
see what populates the actual query sent to the database.
Jeff