======关于大字段的复制问题!!!!=====

sunsfq 2004-01-01 06:05:20
mytable (ID,pic,icon)其中pic,icon均为image型
现在想在mytable中复制自身的一条记录
ID Pic Icon
101 ... ...

102 ... ...
方法一:
strSql="selct * from mytable where ID='101'"
if rs.state<>adStateClosed then
rs.close
end if
rs.open strSql,myCon,1
strSql="insert into mytable(ID,Pic,Icon) values('102','"&rs("pic")&"','"&rs("icon")&"')"
myCon.Execute strSql
方法二:
strSql="selct * from mytable where ID='101'"
if rs.state<>adStateClosed then
rs.close
end if
rs.open strSql,myCon,1
strSql="insert into mytable(ID) values('102')"
myCon.Execute strSql
strSql="selct * from mytable where ID='102'"
if rs1.state<>adStateClosed then
rs1.close
end if
rs1.open strSql1,myCon,1
rs1("Pic").AppendChunk trim(rs("pic"))
rs1("icon").AppendChunk trim(rs("Icon"))
rs1.close
但是两种方法都不成功!!!
...全文
29 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
胖河马 2004-01-02
  • 打赏
  • 举报
回复
!!!!不可能不好使吧,如果不好使出什么错误提示?

strSql="selct * from mytable where ID='101'"
if rs.state<>adStateClosed then rs.close
rs.open strSql,myCon,1,3
set rs1 = rs.clone
rs.addnew
rs("Pic").value = rs1("Pic").value
rs("icon").value = rs1("icon").value
rs.update
set rs1 = nothing
rs.close
hfwpq 2004-01-01
  • 打赏
  • 举报
回复
同意:xialwangf(xl)
rs.Edit
rs("pic").value =rs1("pic").value
rs.update
Try 一下
就像把文件上传到数据库一样的道理。
xialwangf 2004-01-01
  • 打赏
  • 举报
回复
有个好的方法,先把大字段读出来,放到一个变量里。然后复制那条记录,但把大字段先填一个空的值进去,然后再用UPDATE去将前面的变量更新到刚刚复制的那条记录里就可以了。

在ORACLE8i里绝对可行
sunsfq 2004-01-01
  • 打赏
  • 举报
回复
rs.open strSql,myCon,1,3
试过了,没有用
胖河马 2004-01-01
  • 打赏
  • 举报
回复
你open记录集的时候没有指定LockType,默认是只读

strSql="selct * from mytable where ID='101'"
if rs.state<>adStateClosed then rs.close
rs.open strSql,myCon,1,3
set rs1 = rs.clone
rs.addnew
rs("Pic").value = rs1("Pic").value
rs("icon").value = rs1("icon").value
rs.update
set rs1 = nothing
rs.close
sunsfq 2004-01-01
  • 打赏
  • 举报
回复
sunsfq 2004-01-01
  • 打赏
  • 举报
回复
不行
andraw2002 2004-01-01
  • 打赏
  • 举报
回复
在Oracle9i的SQL/Plus中测试通过可以的
andraw2002 2004-01-01
  • 打赏
  • 举报
回复
if rs1.state<>adStateClosed then
rs1.close
end if
strsql="insert into table1 select * from table1 where id=101"
rs.open.......................

试试看这样子行不行呀

28,391

社区成员

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

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