求函数参数作为sql语句中from表的写法

zifan1980 2003-09-19 10:23:44
function check_onedata(web_table)
strSql="select * from table"
这样不行,怎么样写才能吧表定义为参数web_table呢?asp and vb
...全文
96 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
txlicenhe 2003-09-19
  • 打赏
  • 举报
回复
strsql="select * from " & web_table
aierong 2003-09-19
  • 打赏
  • 举报
回复



function check_onedata(web_table as string)

DECLARE @STRSQL
SELECT @strsql='select * from '+web_table
exec(@strsql)
cbzdream 2003-09-19
  • 打赏
  • 举报
回复
strsql="select * from " & web_table
tiny_yan 2003-09-19
  • 打赏
  • 举报
回复
function check_onedata(web_table as string) as int '或其它类型
...
strsql="select * from " & web_table
...
end function
cloud1002 2003-09-19
  • 打赏
  • 举报
回复
应该为:strSql="select * from '" & design1 & "'"
zifan1980 2003-09-19
  • 打赏
  • 举报
回复
<!--#include file="todata.asp"-->
<%
const strMdb="../dewgwbw/tztic-network.mdb"
function check_onedata(design1)
dim objRs,strSql,objCon
'design=design1
call OpenDb(objCon,strMdb)
strSql="select * from " & design1
set objRs=objCon.execute(strSql)
if objRs.eof and objRs.bof then
check_onedata="true"
else
check_onedata="false"
end if
call CloseRs(objRs)
call CloseDb(objCon)
end function
dim i
i=check_onedata(web_info)
response.Write(i)
%>

这一行提示有错误
set objRs=objCon.execute(strSql)
zifan1980 2003-09-19
  • 打赏
  • 举报
回复
根本行不通!

34,874

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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