怎么不能提出数值型变量?,糟了....帮帮我!!..........

jiangshan72 2003-08-13 05:26:47
<%
Dim conn,rs,SQLstring,showblank,shownull,whatever,count,thisfield
Dim tempdata

SQLstring = "SELECT clpz,czmc,dhhm,xj FROM tb_hz where dhhm like '68578772'"

showblank = " "
shownull = "空"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Mode = 1
conn.Open "RYLF"
'Set rs = conn.Execute(SQLstring)
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open SQLstring, conn, 1,1
count = rs.recordcount
IF rs.eof THEN
Response.Write "no this recorde"
END IF
FOR each whatever in rs.fields
Response.Write whatever.name & "   "
NEXT
Response.Write "<BR>"
DO UNTIL rs.eof
FOR each whatever in rs.fields
thisfield = whatever.value
IF isnull(thisfield) THEN
thisfield = shownull
END IF
IF trim(thisfield) = "" THEN
thisfield = showblank
END IF
Response.Write thisfield & "   "
NEXT
Response.Write "<BR>"
rs.Movenext
LOOP



rs.Close
Set rs = nothing
conn.Close
Set conn = nothing
Response.Write "符合条件的记录共有" & count & "条。"
Response.End
%>

用的DB2数据库
当在SELECT 中有数值型变量xj时,返回查找到的记录条数count=0(实际上不为0);
若没有数值型变量xj时,则为正常返回值。
为什么?谢谢
...全文
38 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
awaysrain 2003-08-13
  • 打赏
  • 举报
回复
DB2也有这样的问题吗
oracle里用to_char()函数转换一下就行,DB2里也应该有类似的函数

要不试试改改游标类型看看行不
fengchu2 2003-08-13
  • 打赏
  • 举报
回复
用select *
citybird888 2003-08-13
  • 打赏
  • 举报
回复
可能是你用的数据库对recordcount属性支持不够好,oracle也是这样,可以用“select count(*)...”得到纪录的条数

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧