急问高手!这是不是Java的一个Bug??????

wxyxl 2001-03-13 05:52:00
我用的是Jdk1.2.2,用Jdbc-odbc桥连接的Mssql7数据库,在调用ResultSet对象实例的updateInt()方法时,如: rs.updateInt("accon",345), 而在MSsqlserver7数据库中显示的accon为77770868之类的怪数据,这是什么原因啊,但是下面的操作又没有问题 :
int no=35;
stmt.execute("insert into account values(" + no +",'book',500)");
上面的执行结果在数据库中是正确的数据!
难道是Jdk中的updataInt()有问题吗?
请高手们给一个解释 !
...全文
146 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
skt642 2001-05-31
  • 打赏
  • 举报
回复
48553关注!
lmy2000 2001-03-14
  • 打赏
  • 举报
回复
你可以看看jdk1.3的文档:
当我们修改已有的列值(第5行的name列)时:
rs.absolute(5); // moves the cursor to the fifth row of rs
rs.updateString("NAME", "AINSWORTH"); // updates the
// NAME column of row 5
rs.updateRow(); // updates the row in the data source

当我们新增一行时:
rs.moveToInsertRow(); // moves cursor to the insert row
rs.updateString(1, "AINSWORTH"); //updates the first column of the insert row
rs.updateInt(2,35); // updates the second column
rs.updateBoolean(3, true); // updates the third column
rs.insertRow();
rs.moveToCurrentRow();
wxyxl 2001-03-14
  • 打赏
  • 举报
回复
我试了!还是不行!
lmy2000 2001-03-14
  • 打赏
  • 举报
回复
rs.updateInt(1,35);后需要执行rs.updateRow();
难道还不行。
如果真那样也许就真的是bug了。
wxyxl 2001-03-14
  • 打赏
  • 举报
回复
我是这样做的呀!可是就是不行但是用变量代替就可以,如:
......
int aa=35;
rs.updateInt(1,aa);
.......
这样做,数据在数据库中就能正确的显示。
但是直接用 rs.updateInt(1,35);时在数据库中显示的就是不正确的数。
不知道这是为什么?我认为这是Java的一个Bug!

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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