【问题标题】:ADO recordset EOF and BOF not as expectedADO 记录集 EOF 和 BOF 与预期不符
【发布时间】:2012-01-10 07:08:03
【问题描述】:
arrBand = array("6M","10M","12M","15M","17M","20M","30M","40M","60M","80M","160M")

存储过程是

SELECT * 
FROM tableBand
WHERE UCall=[In_Call] And ACID=[In_CID] and BAND=[In_Band];

以下代码始终执行“非”条件。对于给定的 CRS("CID"),数据库中只有 2 行具有数组值之一,即 6M 和 10M。

for i = 0 to UBound(arrBand)
  ConnTemp.GetMode SanCall, CRS("Cid"), arrBand(i), BandRS
  if not BandRS.EOF and not BandRS.BOF then
    tmp = tmp + "<td style='width: 59px;'>" + arrBand(i) + "<input name='Ck'" +     arrBand(i) + "' type='checkbox' checked='checked'value='Y'/></td>"
  else
   tmp = tmp + "<td style='width: 59px;'>" + arrBand(i) + "<input name='Ck'" + arrBand(i) + "' type='checkbox'/></td>"
end if
BandRS.close
next

【问题讨论】:

  • 看不到您的表数据和正在执行的确切 SQL 语句,很难提供帮助。
  • 确切的 SQL 语句在帖子中。该表包含 3 列,ACID、UCall、Band、所有文本。第1行的数据是1A0,nf4l,6M。第 2 行是 1A0、NF4L、10M。
  • 您确定正在返回数据并且没有发生错误吗?
  • Redfaced,我现在看到我调用了错误的 proc,应该是 getBand。更正后,现在我得到:查询表达式 'UCall=[In_Call] And ACID=[In_CID] and BAND=[In_Band]' 中的语法错误(缺少运算符)。
  • 查询在Access中完美运行。

标签: asp-classic vbscript


【解决方案1】:

事实证明,字段名称“Band”是保留字,即使查询是在 Access 本身中运行的。我把它改成了 Bandx,它现在可以工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多