asp复制一条记录到表尾

来源:百度知道 编辑:UC知道 时间:2024/05/11 16:48:48
sql="insert into download2 select classid,nclassid,tit,images,images2,code,note,size,color,prise,bo,pa,sa,date,tj,bz,jj,other,homenote,tj2 from download2 where id="&id&""
Conn.execute(sql)

id是自动编号的,老是提示Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] 查询值的数目与目标字段中的数目不同。

请高手帮忙!!!!

同一个表中的读和写两次操作不能写在一起吧!

insert 还是新记录插入
既然是新记录 又那里来的 id 让你 where 呢?
分两步走吧,别那么急!

<%
'先用查询 根据你所设定的 条件:id
'得到这条记录,如:
set rs=server.createobject("adodb.recordset")
sql="select classid,nclassid,tit,images,images2,code,note,size,color,prise,bo,pa,sa,date,tj,bz,jj,other,homenote,tj2 from download2 where id="&id&""
rs.open sql,conn,1,3

'避免冲突,赋予一个临时变量上
temp_classid = rs("classid")
temp_nclassid = rs("nclassid")
temp_tit = rs("tit")
.......
temp_tj2 = rs("tj2")

'然后关闭这个查询的数据集
rs.close
set rs=nothing

'再开新操作,插入新数据,默认是插在表尾
set rsto=server.createobject("adodb.recordset")
sql="select * from download2 where (Id is null)"
rsto.open sql,conn,1,3
rsto.addnew

rsto("classid") = temp_classid
rsto("nclassid&qu