SQL SERVER更新字段问题
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