I have to mantain a ASP 3.0 website...
And I would like to protect sql statements.
The select statements I could protect with this code:
set cmd = Server.createObject("adodb.command")
cmd.commandText = "select from Foo where id=?"
set cmd.activeConnection = someConnection
set rs = cmd.execute(rows_affected, Array(42))
But I can't make it to work when I replace the select by update or insert statements.
Can anyone help me?
the code i am trying is:
sqlS1 = "INSERT into users (nome2) values (?)"
arParams = 1
set cmd = createobject("ADODB.Command")
cmd.CommandText = sqlS1
cmd.ActiveConnection = session("bdc")
cmd.Execute(,arParams,adExecuteNoRecords)
That should run if you drop the parentheses:
cmd.Execute , arParams, adExecuteNoRecords
Or
cmd.Execute recs, arParams, adExecuteNoRecords
Response.write recs & " updated"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With