如何查找vbscript/asp中是否存在字段
我有一台录音机。我想知道是否存在名为MyField的字段 如何确定字段是否存在如何查找vbscript/asp中是否存在字段,vbscript,asp-classic,Vbscript,Asp Classic,我有一台录音机。我想知道是否存在名为MyField的字段 如何确定字段是否存在 while not oRs.eof if oRs.Fields("MyField").Exists = true and oRs("MyField") then ' Result is true end if oRs.movenext wend Yrs Sincerly您将需要一个helper函数来迭代字段并进行比较 dim exists: exists = ContainsField
while not oRs.eof
if oRs.Fields("MyField").Exists = true and oRs("MyField") then
' Result is true
end if
oRs.movenext
wend
Yrs Sincerly您将需要一个helper函数来迭代字段并进行比较
dim exists: exists = ContainsField(oRs, "MyField")
while not oRs.eof
if exists ...
使用
function ContainsField(rs, name)
dim fld
name = UCase$(name)
for each fld in rs.Fields
if UCase$(fld.name) = name then
ContainsField = true
Exit Function
end if
next
ContainsField = False
End function
您需要一个helper函数来迭代字段并进行比较
dim exists: exists = ContainsField(oRs, "MyField")
while not oRs.eof
if exists ...
使用
function ContainsField(rs, name)
dim fld
name = UCase$(name)
for each fld in rs.Fields
if UCase$(fld.name) = name then
ContainsField = true
Exit Function
end if
next
ContainsField = False
End function
您需要一个helper函数来迭代字段并进行比较
dim exists: exists = ContainsField(oRs, "MyField")
while not oRs.eof
if exists ...
使用
function ContainsField(rs, name)
dim fld
name = UCase$(name)
for each fld in rs.Fields
if UCase$(fld.name) = name then
ContainsField = true
Exit Function
end if
next
ContainsField = False
End function
您需要一个helper函数来迭代字段并进行比较
dim exists: exists = ContainsField(oRs, "MyField")
while not oRs.eof
if exists ...
使用
function ContainsField(rs, name)
dim fld
name = UCase$(name)
for each fld in rs.Fields
if UCase$(fld.name) = name then
ContainsField = true
Exit Function
end if
next
ContainsField = False
End function
如果您不知道字段索引的名称,也可以使用字段索引。如果您不知道字段索引的名称,也可以使用字段索引。如果您不知道字段索引的名称,也可以使用字段索引。如果您经常使用帮助器函数并影响性能,您可以考虑将字段名存储为<代码>脚本>字典<代码>对象。这就创建了一个哈希图和<>代码>存在(key)方法非常快。如果你经常使用帮助函数并困扰你的性能,你可以考虑将字段名存储为<代码>脚本。字典< /Cord>对象。这就创建了一个哈希图和<>代码>存在(key)方法非常快。如果你经常使用帮助函数并困扰你的性能,你可以考虑将字段名存储为<代码>脚本。字典< /Cord>对象。这就创建了一个哈希图和<>代码>存在(key)方法非常快。如果你经常使用帮助函数并困扰你的性能,你可以考虑将字段名存储为<代码>脚本。字典< /Cord>对象。这将创建一个hashmap,
.Exists(key)
方法非常快。