SQL SERVER更新字段问题

wuridong 2006-04-19 10:58:38
SQL SERVER字段更新不了!请大家指点一下!我想把数据添加完后更新rs("source_id")=doc_id这个字段,它们是在一个表中的两个字段。
doc_id是自动编号!

代码如下

sql = "select * from tb_doc_senda where id is null"
conn.BeginTrans
rs.Open sql,conn,1,2
rs.addnew
rs("doc_type")=doc_type
rs("drafter")=drafter
rs("phone")=phone
rs("department")=department
rs("title")=title
rs("priority")=priority
rs("content")=content
rs("audit_dept")=audit_dept
rs("auditor")=auditor
rs("secrecy")=secrecy
rs("doc_state")=doc_state

rs("doc_serial")=doc_serialb
rs("doc_header")=doc_headerb
rs("send_type")=send_typeb
rs("keyword")=keyword_recvb
rs("sendto_main")=sendto_mainb
rs("sendto_copy")=sendto_copyb
rs("note")=noteb
filetitle=Session("flname")
if filetitle<>"" then
rs("addfile_name")=filetitle
end if
session("flname")=""
if addfile_name<>"" then
rs("addfile_name")=addfile_name
rs("addfile_type")=addfile_type
rs("addfile_size")=addfile_size
rs("addfile_content").appendchunk addfile_content
end if
if doc_state=0 then
rs("doc_active")=1
end if
rs.update()
if rs("id")<>"" then
doc_id=rs("id")
rs("source_id")=doc_id
end if
rs.update()
rs.close()
if doc_state=0 then
sql="select * from tb_doc_audita where id is null"
rs.Open sql,conn,1,2

rs.addnew
rs("doc_id")=doc_id

rs("fromman")=drafter
rs("auditor")=auditor

rs("source_id")=doc_id
rs("doc_type")=doc_type

rs.update()
rs.close()
end if
conn.CommitTrans
...全文
122 4 打赏 收藏 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuridong 2006-04-19
  • 打赏
  • 举报
回复
大家帮的解决一下把!谢谢了!
wuridong 2006-04-19
  • 打赏
  • 举报
回复
rs.Open sql,conn,1,2 2全部改成3
我试了不行呀!?
yousite1 2006-04-19
  • 打赏
  • 举报
回复
rs.Open sql,conn,1,2 2全部改成3
wuridong 2006-04-19
  • 打赏
  • 举报
回复
??????????

28,402

社区成员

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

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