求助高手帮帮忙!!谢谢 数据库问题

yer1121 2006-09-04 10:13:40
错误类型:
ADODB.Recordset (0x800A0CB3)
/test/tt.asp, 第 9 行 请教高手增加表的记录哪里有问题?(我的意图是把表stock中type字段不和表storage同名记录增加到storage中)

<!--#include file="connect.asp"-->
<%
sq="select distinct type as mm,amount as nn from storage,stock where stock.type not in (select model from storage)"
set rs=conn.execute(sq)
rs.movefirst
while not rs.eof
a=rs("mm")
b=rs("nn")
rs.addnew
rs("model")=a
rs("num")=b
rs.update
rs.movenext
wend
rs.close
conn.close
set rs=nothing
set conn=nothing %>
...全文
84 6 打赏 收藏 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
yer1121 2006-09-04
  • 打赏
  • 举报
回复

如何这样能够写还是同样 rs.addnew这里错误 type,amount属于表stock中字段
<!--#include file="connect.asp"-->
<%
sq="select distinct * from storage,stock where stock.type not in (select model from storage)"
set rs=conn.execute(sq)
rs.movefirst
while not rs.eof
a=rs("type")
b=rs("amount")
rs.addnew
rs("model")=a
rs("num")=b
rs.update
rs.movenext
wend
rs.close
conn.close
set rs=nothing
set conn=nothing %>
什么都不能 2006-09-04
  • 打赏
  • 举报
回复
select distinct type as mm,amount as nn from storage,stock where stock.type not in (select model from storage)
??????????????
这个里面根本就没有查询model和num字段,而且这样写法,我不清楚是不是有其他问题
yer1121 2006-09-04
  • 打赏
  • 举报
回复
改成这样子了 还是出现rs.addnew这个老问题 数据库连接和字段匹配没问题 因为其它数据查询更新都可以执行出结果,就这个增加有问题
字段id,model,num都是不能为空的字段

<!--#include file="connect.asp"-->
<%
sq="select distinct stock.type as mm,stock.amount as nn,storage.model as kk,storage.id as jj,storage.num as hh from storage,stock where stock.type not in (select model from storage)"
set rs=conn.execute(sq)
i=10
rs.movefirst
while not rs.eof
a=rs("mm")
b=rs("nn")
rs.addnew
rs("kk")=a
rs("hh")=b
rs("jj")=i
rs.update
i=i+1
rs.movenext
wend
rs.close
conn.close
set rs=nothing
set conn=nothing %>
cloudgamer 2006-09-04
  • 打赏
  • 举报
回复
看看数据库有没有问题
ninansky 2006-09-04
  • 打赏
  • 举报
回复
where stock.type not in (select model from storage)"

会不会是stock.type跟storage.model的类型不匹配哦
瞎说的,嘿嘿
yer1121 2006-09-04
  • 打赏
  • 举报
回复
自己up一下

28,402

社区成员

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

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