为什么数据不能更新????急...在线等

huntgirl 2003-10-15 04:31:51
我用下面这段代码对imageId为4000的记录进行更新,可是总更新不了,
提示, Current Recordset does not support updating.This may be a limitatiion of the provider,or of the selected locktype.
我把rs.lockType的四个属性都试了一次,也没有成功的.这是为什么??

mstream.Open
mstream.LoadFromFile "e:\13.jpg"
'ÏÈ°Ñimageid=4000µÄ¼Ç¼ÕÒ³öÀ´
Set rs = con.Execute("select * from tb1 where imageID=4000")
rs.update
rs!question = "这是为什么?"
rs!imageID = 4000
rs!Picture = mstream.Read
rs.UpdateBatch
mstream.Close
...全文
33 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
yoki 2003-10-15
  • 打赏
  • 举报
回复
麻烦!
这样代替即可

con.execute"update from tb1 set question ='这是为什么?',
Picture =" & mstream.Read & " where imageID=4000"
huntgirl 2003-10-15
  • 打赏
  • 举报
回复
zhangqs(zhangqs) 说的对,
不过还有一个关键的地方是,把rs!ITemId=4001去掉.
sword281 2003-10-15
  • 打赏
  • 举报
回复
据我的理解,用execute得到的rs不能用addnew,delete,update方法要用sql语句对表操作,
使用rs.open方式能支持addnew,delete,update方法
射天狼 2003-10-15
  • 打赏
  • 举报
回复
记录集的游标类型不对!!
huntgirl 2003-10-15
  • 打赏
  • 举报
回复
可能我没说清,imageID是access表里的主键.
to golden24kcn(不甜)
提示大意由于将在索引,主关键字或关系表中创建重复的值,请求对表的改动没有成功.


zhangqs 2003-10-15
  • 打赏
  • 举报
回复
Set rs = con.Execute("select * from tb1 where imageID=4000")改为

rs.open "select * from tb1 where imageID=4000",con,3,3
j4sxw 2003-10-15
  • 打赏
  • 举报
回复
rs.update删除
rs.UpdateBatch改为rs.update
golden24kcn 2003-10-15
  • 打赏
  • 举报
回复
Rst.Open SQL, Conn, adOpenStatic, adLockPessimistic, adCmdText
mstream.Type = adTypeBinary
rs!question = "这是为什么?"
rs!imageID = 4000
rs!Picture = mstream.Read
rs.Update
mstream.Close

1,216

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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