为什么出现“将 varchar 值 's' 转换为数据类型为 int 的列时发生语法错误。”
想用JTree建一棵树,监听叶子节点的变化并显示出来,数据库(SQL Server2000)里节点node是varchar类型,一开始为方便用数字1,2、、、代替,一切正常,可是后来我改为中文后(甚至英文字母也是)就出错了,究竟什么原因啊?
=============///递归建树:
public void Creat(String pid, DefaultMutableTreeNode parent) {
try {
String sql = "select * from Test where ParentsID = " + pid;
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
node = new DefaultMutableTreeNode(rs.getString(3));
parent.add(node);
Creat(rs.getString( "ID "), node);