首页 > 代码库 > ASP函数:根据表和ID和字段名,返回内容

ASP函数:根据表和ID和字段名,返回内容

‘//根据表和ID和字段名,返回内容
Function dsf_fieldValueFromTable(fTable,id,fieldName)
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="select * from " & fTable & " where id=" & id
rs.open sql,conn,1,1
if not rs.eof then
dsf_fieldValueFromTable=rs(fieldName)
end if
rs.close
set rs=nothing
End Function