0
vbscript的新手位,不是特別喜歡它,但我的客戶端使用它,所以我不能做太多的事情!我無法使用參數化查詢將數據添加到數據庫中!請救我傢伙!ADO中的參數化查詢 - 將數據添加到數據庫中
到目前爲止,現有的代碼是
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可變我要讓參數爲安全起見,顯然哈哈!我只是不知道該怎麼做!我讀過的東西我只是感到困惑,請幫助!提前謝謝了!
感謝您的鏈接,我一定會申請這個,看看我去!再次感謝你!! –