请问这句SQL怎么写??谢谢。

xmayxmei 2003-12-31 02:29:25
for i = 1 to request.form("flow").count
sql="update news set ntype='"ntype"' where id='"request.form("flow")(i)"'
conn.execute(sql)
其中NTYPE是数字,FLOW是字符,
我是用CHECKBOX传来的值来执行批量更新,各位大哥帮帮忙!!!
...全文
38 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
king2world 2003-12-31
  • 打赏
  • 举报
回复
好像也不对,ntype是数字,id正常来讲也应该是数字啊,如果都是数字的话用
update news set ntype="&ntype&" where id="&request.form("flow")(i)
king2world 2003-12-31
  • 打赏
  • 举报
回复
同意wertou(小贝(ECKHAM)的
xiantao123 2003-12-31
  • 打赏
  • 举报
回复
for i = 1 to request.form("flow").count
ntype=clng(ntype)
dim id
id=clng(requset("flow")(i))
sql="update news set ntype=" & ntype & " where id=" & id
conn.execute(sql)

主要是变量数据类型要和数据库中表的字段的数据类型匹配。
xiantao123 2003-12-31
  • 打赏
  • 举报
回复
for i = 1 to request.form("flow").count
ntype=clng(ntype)
dim id
id=clng(requset("flow")(i)
sql="update news set ntype=" & ntype & " where id=" & id
conn.execute(sql)

主要是变量数据类型要和数据库中表的字段的数据类型匹配。
美丽心情 2003-12-31
  • 打赏
  • 举报
回复
sql="update news set ntype=&'"ntype&"' where id='"&request.form("flow")(i)&"'

还有,你的语句哪里报错?什么错误信息?
  • 打赏
  • 举报
回复
sql="update news set ntype=" & ntype & " where id='" & request.form("flow")(i) & "'"
  • 打赏
  • 举报
回复
sql="update news set ntype='" & ntype & "' where id="request.form("flow")(i)
  • 打赏
  • 举报
回复
用repsonse.write输出一句,在查询分析器里执行,正确就可以了,
慢慢试了
xmayxmei 2003-12-31
  • 打赏
  • 举报
回复
ID是自动的,NTYPE是数字型的。
还是有问题啊!~!
xmayxmei 2003-12-31
  • 打赏
  • 举报
回复
还是有错啊。。
xiaoyuehen 2003-12-31
  • 打赏
  • 举报
回复
你写的代码我看起来有点奇怪...

假设其他没有错误的话..sql中的连字符应该加上,也假设数据库中id字段为自动编号类型则
sql="update news set ntype=" & ntype & " where id=" & request.form("flow" & i )
wshzhi 2003-12-31
  • 打赏
  • 举报
回复
sql="update news set ntype="&ntype&" where id="&request.form("flow")(i)"
my0707 2003-12-31
  • 打赏
  • 举报
回复
for i = 1 to request.form("flow").count
sql="update news set ntype=" & ntype & " where id='" & request.form("flow" & i ) & "'
conn.execute(sql)

28,406

社区成员

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

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