Topic: 从数据库中读取汉字,结果显示的东西看不懂,请教

  Print this page

1.从数据库中读取汉字,结果显示的东西看不懂,请教 Copy to clipboard
Posted by: RingofAngel
Posted on: 2005-07-26 10:34

public void textField1_focusLost(FocusEvent e) {//输入档案编号 焦点移出 自动生成档案名称
try{
String fileNo = textField1.getText().trim();
if (!fileNo.equals("")) {
String order =
"select FILE_NAME from DOCUMENT_AFFAIR where FILE_NO=" +
fileNo;
rs=stmt.executeQuery(order.toString());
textField2.setText(rs.toString());
}
}catch(Exception ex1){
textField1.setText("");
}
}
数据库中是4个中文字。可是,run的时候,出现的是
oracle.jdbc.driver.OracleResultSetImpl@2c35e

小弟不知道这样的问题属于JDBC的问题还是基础编程的错误,又慕 why 的大名,来这里请教各位。

2.Re:从数据库中读取汉字,结果显示的东西看不懂,请教 [Re: RingofAngel] Copy to clipboard
Posted by: why
Posted on: 2005-07-26 11:24

rs is a ResultSet
rs.toString() won't give you FILE_NAME
try rs.getString(1);

Please don't ask me why, you'd better do your study.
And sorry, I'm not familiar with the handling of 汉字


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923