欢迎光临
我们一直在努力

ASP自定义函数,仿VBA中域函数DLookup-ASP教程,ASP应用

建站超值云服务器,限时71元/月

function dlookup(strfieldname, strtablename, strwhere, objconn)

参考access vba 中的dlookup函数

由于环境不同,加了objconn参数,直接将adodb.connection直接调进来

dim strsql

dim rs

set rs = server.createobject("adodb.recordset")

下面要调用外部的一个自定义函数 checksql()

strfieldname = checksql(strfieldname)

if strwhere <> "" then

strwhere = " where " & strwhere

end if

strsql="select "&strfieldname&" from "&strtablename&" " & strwhere

debugstop strsql

on error resume next

rs.open strsql, objconn, 1, 1

if err <> 0 then

response.write err.description

response.end()

end if

if rs.eof and rs.bof then

dlookup = ""

else

要调用一个自定义函数 nz

详细内容请参考 access vba 帮助中的资料

dlookup = nz(rs(strfieldname), "")

end if

rs.close

end function

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » ASP自定义函数,仿VBA中域函数DLookup-ASP教程,ASP应用
分享到: 更多 (0)

相关推荐

  • 暂无文章