function传递参数 类型不匹配

christy_fang 2009-08-19 09:56:26

function getrow(area)
rowsqlstr="select d_coding,d_name from hydepart h where len(d_coding)=6 and isdzx='"&area&"' "
rowsqlstr=rowsqlstr+"and d_coding in (select left(d_coding,6) from hydepart where len(d_coding)>6 "
rowsqlstr=rowsqlstr+"and d_coding in (select pb_dep from purchasebill where pb_flag=1))"
set rowRs=server.CreateObject("adodb.recordset")
rowRs.Open rowsqlstr,conn,3
If not rowRs.EOF then
RTT=rowRs.RecordCount
else
RTT=0
end if
getrow=RTT
rowRs.Close
set rowRs=nothing
end function


<%
getrow("东")
%>


上面是自己写的方法,用来读行数
下面调用,很简单的
可是为什么就是报“类型不匹配”呢?
找不到问题所在啊,所以来请教大家咯!






...全文
103 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzp4881 2009-08-19
  • 打赏
  • 举报
回复
<%=getrow("东")%>
gxq323 2009-08-19
  • 打赏
  • 举报
回复
rowRs.Open rowsqlstr,conn,3
就一个参数吗?
christy_fang 2009-08-19
  • 打赏
  • 举报
回复
asp我不知道调试@!!!!
凡夫与俗子 2009-08-19
  • 打赏
  • 举报
回复
单独调试看看。
hookee 2009-08-19
  • 打赏
  • 举报
回复
如果是函数错,应该报到函数里面吧
把函数中的代码单独调试看看
christy_fang 2009-08-19
  • 打赏
  • 举报
回复
conn是全局打开的,而且我下面也写了个类似的方法,那个就没有问题!
不耐烦 2009-08-19
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 hookee 的回复:]
conn是全局打开的吗?
[/Quote]

也许是这个问题
christy_fang 2009-08-19
  • 打赏
  • 举报
回复
是啊 isdzx也是varchar类型的啊!
就是找不到是哪的错!郁闷1
hookee 2009-08-19
  • 打赏
  • 举报
回复
conn是全局打开的吗?
hookee 2009-08-19
  • 打赏
  • 举报
回复
问题应该不是赋值
不耐烦 2009-08-19
  • 打赏
  • 举报
回复
isdzx 字段是什么类型的 如果不是 文本 就会出错
hookee 2009-08-19
  • 打赏
  • 举报
回复
要赋值
<%
s = getrow("东")
%>
christy_fang 2009-08-19
  • 打赏
  • 举报
回复
就是传参数的地方出错
<%
getrow("东")
%>
这里
说类型不匹配
hookee 2009-08-19
  • 打赏
  • 举报
回复
哪句报错?
最好直接用select count(*) from...

function getrow(area)
rowsqlstr="select d_coding,d_name from hydepart h where len(d_coding)=6 and isdzx='" & area & "' "
rowsqlstr=rowsqlstr & "and d_coding in (select left(d_coding,6) from hydepart where len(d_coding)>6 "
rowsqlstr=rowsqlstr & "and d_coding in (select pb_dep from purchasebill where pb_flag=1))"
set rowRs=server.CreateObject("adodb.recordset")
rowRs.CursorLocation = 3
rowRs.Open rowsqlstr,conn,1,1
If not (rowRs.EOF AND rowRs.BOF) then
RTT = rowRs.RecordCount
else
RTT = 0
end if
getrow=RTT
rowRs.Close
set rowRs=nothing
end function

黑心 2009-08-19
  • 打赏
  • 举报
回复
from hydepart h where

christy_fang 2009-08-19
  • 打赏
  • 举报
回复
想了另外的方法解决了 谢谢大家了!
christy_fang 2009-08-19
  • 打赏
  • 举报
回复
赋值了也是错的!结果一样1

28,391

社区成员

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

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