取id的技巧

qinshiyuechen 2003-02-02 10:31:51
帮帮小弟看看下面的代码:
要取得网址:http://127.0.0.1/hw/fuwu/tijiao/jy.asp?id=3中
的id的值,也就是3,然后将其添加到sql server中,代码如下,可是
出错不行(显示rs("dl_id") = id有错误),应该是我取id的方法不对。
请诸位教教小弟!!!
新年快乐!!!!!


<!-- #include virtual="/kjasp/func/DB.fun" -->
<%
set conn= getsqlserverconnection("cccc","sa","1234","hw")
set rs = getsqlserverstaticrecordset(conn,"dl_dd")
%>

<%
id=Request("id")
%>

<%

classid = Request("classid")
Nclassid = Request("Nclassid")
rl = Request("rl")
gs = Request("gs")

if request("rl")="" then
Response.Redirect "error.htm"
end if
if request("gs")="" then
Response.Redirect "error.htm"
end if
flag = 1
rq = now()

rs.addnew
rs("dl_id") = id "这行报出有错误,id没有取道值"
rs("dl_zl") = classid
rs("dl_lx") = Nclassid

rs("dl_rl") = rl
rs("dl_gs") = gs
rs("dl_flag") = flag
rs("dl_rq") = rq

rs.update


' 将网页重定向到jy.asp
Response.Redirect "jy.asp"
%>

还有是比方我输入后要将网页重定向到http://127.0.0.1/hw/fuwu/tijiao/jy.asp?id=3,
下,相应的Response.Redirect "jy.asp?用户id",怎么写。我要取得不同登陆者的id,
当其第一次输入后,若其还想操作,还要回到其上一次的操作界面。也就是将网页重定向
到原先状态,怎么写。
...全文
300 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
baggio785 2003-02-02
  • 打赏
  • 举报
回复
1 id是否取道
2 id类型和数据库中是否相符
3 数据库中的id是否为自动增长的,如果是肯定不行
earthpea 2003-02-02
  • 打赏
  • 举报
回复
我不知道你的对不对,只是我自己是这样做的:
page=Request.QueryString("page")
if page="" or page <1 then page=1
guest=Request.QueryString("guest")
if guest="" then guest="all"
yicaoyimu 2003-02-02
  • 打赏
  • 举报
回复
response.write request("id")
看看有值么?
转向
Response.Redirect "jy.asp?id="&request("id")


28,390

社区成员

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

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