请教一个关于asp与mysql的问题!

wsaseven 2007-03-29 10:03:32
请问mysql不支持rs.addnew或者是rs.update吗?


sqltest="select * from new_result where username ='" & username & "' and test_code=" & exam_pa_id & ""
set rstest=server.createobject("adodb.recordset")
rstest.open sqltest,Conn,1,3
if not(rstest.bof and rstest.eof) then
response.Write("<br><li>数据冲突</li>")
else


rstest.addnew
rstest("username")=username
rstest("test_code")=exam_pa_id
rstest("f_status")="N"
rstest("f_date")=date()
rstest("result")=result
rstest("choice")=choice
rstest.update
end if


我使用上面的代码对mysql数据库操作的时候提示我:
[
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC 驱动程序管理器] 无效的字符串或缓冲区长度
]
但我使用:
Conn.Execute("insert into new_result (username,test_code,f_status,f_date,result,choice) values ('"&username&"',"&cint(exam_pa_id)&",'N','"&date()&"','"&result&"','"&choice&"')")

的时候就没有错误,请问是什么原因呢??
(PS:这个问题在我使用update更新数据库已有数据的时候也同样存在)
...全文
279 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangxiao_jiang 2007-04-02
  • 打赏
  • 举报
回复
mysql我没有用过这个类型,不过有的数据库如果有BLOB大字段的时候,是需要分开更新的.
你测试一下,就update这个字段,应该是可以完成的.
wsaseven 2007-03-29
  • 打赏
  • 举报
回复
问题补充:在网上找了一下,发现一个同我遇到相同问题的,似乎出问题的字段好象都是因为使用了text类型。不知道什么原因,请高手指点!!!
(另一个出现和我同样问题的帖子是:http://www.51log.net/dev/301/4493075.htm)
wsaseven 2007-03-29
  • 打赏
  • 举报
回复
找到问题的原因了,就是这里“rstest("result")=result”,我的result里面是"annnnnnnnnnnnnnnnnnnn",共20个字符,如果用insert into 就可以把它插入到类型是text的字段,但用update就不行,这是为什么呢????
wsaseven 2007-03-29
  • 打赏
  • 举报
回复
up

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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