请教一个关于函数的问题。

iStringTheory 2002-03-04 05:45:22
我写了一个函数,如下:
'**************
'函数名 ifExist
'传参:Source_Table 数据表名;Source_col 数据列;Item_Searched 待搜索项目;
'功能:检查指定项目在指定数据表中是否存在
'**************
dim Source_Table
dim Item_Searched
dim Source_col
function ifExist(byVal Item_Searched,byVal Source_col,byVal Source_Table)
dim tmprs
'response.write("select Source_col from Source_Table where Source_col='Item_Searched'")
'response.end
set tmprs=conn.execute("select Source_col from Source_Table where Source_col='Item_Searched'")
if tmprs.bof and tmprs.eof then
ifExist="0"
else
ifExist="1"
end if
tmprs.close
set tmprs=nothing
end function

在做传值调用的时候出现如下错误:
错误的参数个数或无效的参数属性值

我调用的那行程序为:ifExist '1','Topic','Topic'

哪儿错了??谢谢各位帮助!
...全文
68 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
songzx66 2002-03-05
  • 打赏
  • 举报
回复
sql语句错了
set tmprs=conn.execute("select "& Source_col& " from "& Source_Table& " where "&Source_col&"='"& Item_Searched& "'")
songzx66 2002-03-05
  • 打赏
  • 举报
回复
SQL语句
set tmprs=conn.execute("select "&Source_col&" from "&Source_Table&" where Source_col='"&Item_Searched&"'")

调用
response.write ifExist("1","Topic","Topic")
iStringTheory 2002-03-05
  • 打赏
  • 举报
回复
还是“错误的参数个数或无效的参数属性值”错误,但函数运行正常,既然函数都可以正常运行,怎么还有这个错误?我是用on error resume next忽略过这个错误的,应该怎样解决?
iStringTheory 2002-03-05
  • 打赏
  • 举报
回复
大家帮帮我,谢谢
iStringTheory 2002-03-05
  • 打赏
  • 举报
回复
谢谢,songzx66() 请去http://www.csdn.net/Expert/TopicView1.asp?id=555513拿分!
iStringTheory 2002-03-04
  • 打赏
  • 举报
回复
调用以后,直接response.write ifExist怎么打印不出0或者1?
ssm1226 2002-03-04
  • 打赏
  • 举报
回复
调用时不能用单引号:
ifExist “1”,“Topic”,“Topic”
ssm1226 2002-03-04
  • 打赏
  • 举报
回复
set tmprs=conn.execute("select "& Source_col &" from"&Source_Table&" where Source_col='"&Item_Searched&"'")
iStringTheory 2002-03-04
  • 打赏
  • 举报
回复
我本来是放了50分的。怎么只有1分??怎么加分啊?新版太差了,什么都找不到。

28,406

社区成员

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

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