为什么库中的记录修改不了
public int modLink(Hashtable hash)
{
String strNAME = ds.toString((String)hash.get( "LINK_NAME "));
String strURL = ds.toString((String)hash.get( "LINK_URL "));
String strSTATE = ds.toString((String)hash.get( "LINK_STATE "));
String strBID = ds.toString((String)hash.get( "LINK_BID "));
Vector vect = new Vector();
vect.add( "BID_LINK ");
vect.add(addVector( "LINK_NAME ",strNAME, "VARCHAR "));
vect.add(addVector( "LINK_URL ",strURL, "VARCHAR "));
vect.add(addVector( "LINK_STATE ",strSTATE, "NUM "));
vect.add(addVector( "LINK_BID ",strBID, "NUM "));
vect.add( " LINK_ID= ' "+id+ " ' ");
//检验是否已经存在
ResultSet rs = selectRecord( "select LINK_ID from BID_LINK where LINK_NAME= ' "+strNAME+ " ' and LINK_ID <> ' "+id+ " ' ");
Statement stmt = null;
try{
if(!rs.next())
{
int t = updateRecord(vect);
return t;
}
}catch(Exception e){System.out.println( "运行时出错: "+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println( "关闭记录集rs时出错 "+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println( "关闭声明时statement出错 "+e);}
}
return 1;
}
测试断点strBID这些都是有值的,为什么改不了数据库的记录?
------解决方案--------------------把updateRecord(vect)贴出来。
可能是里面没有保存。如果用的是hibernate,一定记得最后要save()。
------解决方案--------------------那就是你的查询语句查询的结果为0