数据库中如何在自定义函数中执行insert或update

来源:百度知道 编辑:UC知道 时间:2024/05/12 03:50:23
必须用函数,因为要直接作为select语句的字段值,所以如何在自定义函数中执行insert或update.

在自定义函数中无法调用存储过程...所以也不可能用自定义函数去调用有insert或update的存储过程.

我的一个例子,不知道对不对,也许不是你要求的:
如果觉得可行,就把字段写上,我再改。
'''''''''''''''''''''start''''''''''''''''
function updatesql(x,y)
set rs_tmp=server.createobject("adodb.recordset")
rs_tmp.open "select * from table where id="&x,conn,1,3
if rs_tmp.bof then
response.write("SORRY,没找到记录")
else
rs_tmp("title")=y
rs_tmp.update
end if
rs_tmp.close
set rs_tmp=nothing
end function
'''''''''''''''''''''end''''''''''''''''