ASP页面取数据库值

qiudazhi 2014-02-12 02:33:08
pix=request("pixs")
if lvl = "" then
response.write "非法用户?"
objcn.close
set objcn = nothing
response.end

end if

上面是我在一个asp页面看到的代码,意思是权限为空的话显示非法用户,我现在想在asp页面中取出数据库中某个字段的值,不知道怎么实现?求支援呐。。。
...全文
236 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
qiudazhi 2014-02-13
  • 打赏
  • 举报
回复
引用 6 楼 showbo 的回复:
pix=request("pixs") set rs=objcn.execute("select id from yourtable where条件") if not( rs.eof or rs.bof) then id=rs(0) 去学下基础了,这么基础的都不会
我不是搞这一块的,突然一个网站里冒出这个东西,看不懂,哈哈,见笑啦
小路子的宝 2014-02-13
  • 打赏
  • 举报
回复
引用 6 楼 showbo 的回复:
pix=request("pixs") set rs=objcn.execute("select id from yourtable where条件") if not( rs.eof or rs.bof) then id=rs(0) 去学下基础了,这么基础的都不会
Go 旅城通票 2014-02-13
  • 打赏
  • 举报
回复
pix=request("pixs") set rs=objcn.execute("select id from yourtable where条件") if not( rs.eof or rs.bof) then id=rs(0) 去学下基础了,这么基础的都不会
qiudazhi 2014-02-13
  • 打赏
  • 举报
回复
引用 1 楼 showbo 的回复:
不直接用游标读数据库就好了。。

pix=request("pixs")
set rs=objcn.execute("你的sql语句")
'处理rs游标的代码
if lvl = "" then 
    response.write "非法用户?"
    objcn.close
    set objcn = nothing
    response.end
 
end if
我没学过vb,也没学过asp,这个处理rs游标怎么处理啊,就跟lvl=""一样怎么写?假如我数据库中选出的字段是id,如何写if id="" then ...
yj05328 2014-02-13
  • 打赏
  • 举报
回复
s=jdt("数据库字段名") '上面写错了
yj05328 2014-02-13
  • 打赏
  • 举报
回复
pix=request("pixs") if lvl = "" then response.write "非法用户?" objcn.close set objcn = nothing response.end end if 这个lvl 是变量还是从数据库取出来的? 去数据库的值,首先要读出数据表 sql1="select* from table" set jdt=server.CreateObject("adodb.recordset") jdt.open sql1,conn,1,1 if not jdt.eof then '有值 s=jdt("值") end if response.write(s) '取值 循环取值 do while not jdt.eof s=jdt("值") jdt.movenext loop
KeepSayingNo 2014-02-12
  • 打赏
  • 举报
回复
大致像下面这样

SimpleDatabase db = DatabaseFactory.GetDatabase();
return db.ExecuteDataSet(CommandType.Text, sql);
李睿_Lee 2014-02-12
  • 打赏
  • 举报
回复
基础知识请看手册与教程。
KeepSayingNo 2014-02-12
  • 打赏
  • 举报
回复
你在你的系统项目中找下数据库建立连接的代码,我想你们肯定是封装好了,如果是封装好了,那么直接实例化一个数据库,然后让这个数据库对象执行SQL就可以了
Go 旅城通票 2014-02-12
  • 打赏
  • 举报
回复
不直接用游标读数据库就好了。。

pix=request("pixs")
set rs=objcn.execute("你的sql语句")
'处理rs游标的代码
if lvl = "" then 
    response.write "非法用户?"
    objcn.close
    set objcn = nothing
    response.end
 
end if

28,391

社区成员

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

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