asp下检查表中是否存在某个字段(列)函数


复制代码 代码如下:

Function CheckFields(FieldsName,TableName)
Flag=False
sql="select * from "&TableName
Set RS=Conn.Execute(sql)
for i = 0 to RS.Fields.Count - 1
if RS.Fields(i).Name=FieldsName then
Flag=True
Exit For
else
Flag=False
end if
Next
CheckFields=Flag
End Function

复制代码 代码如下:
Function CheckFields(FieldsName,TableName)
Flag=False
sql="select * from "&TableName
Set RS=Conn.Execute(sql)
for i = 0 to RS.Fields.Count - 1
if RS.Fields(i).Name=FieldsName then
Flag=True
Exit For
else
Flag=False
end if
Next
CheckFields=Flag
End Function


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3