vbscript 的新手,不是特别喜欢它,但我的客户使用它,所以我无能为力!我无法使用参数化查询将数据添加到数据库中!请大家救救我!!
到目前为止,现有的代码是
function ecaddupdateDEV (thistable, idvar, vararray)
for each varname in vararray
valstring = valstring & ", session(""" & varname & """)"
thesefields = thesefields & ", " & varname
next
thesefields = idvar & thesefields
valstring = " array( " & ecremovel(valstring, 2) & ")"
vals = eval(valstring)
set temprs = Server.CreateObject("ADODB.RecordSet")
if session(idvar) = 0 then
'response.Write("chid is 0 add new record")
' ADD THIS REC
temprs.open thistable, db,1,3,2
temprs.AddNew vararray, vals
ecaddupdateDEV = temprs(idvar)
temprs.close
set temprs = ecquery("select " & idvar & " from " & thistable & " order by " & idvar & " desc ")
ecaddupdateDEV = temprs(idvar)
else
' UPDATE THIS REC
selectclause = "select " & thesefields & " from " & thistable & " where " & idvar & " = " & session(idvar)
temprs.open selectclause, db ,1,3
temprs.update vararray, vals
ecaddupdateDEV = temprs(idvar)
temprs.close
end if
set temprs = nothing
end function
出于安全目的,我想要参数化的 temprs 变量,显然是大声笑!我只是不知道该怎么做!我刚刚读到的内容令人困惑,请帮助!提前谢谢了!