这是我的问题: 我的问题是,我有dc
作为变量,如果这个变量为null,那么应该执行其他部分。 但是这里的条件是当if()部分执行时它不会进入if(rs.next())
?为什么? 当我的直流值是2时,rs.next()
正在工作,但是当它是1时,它不工作。错误在rs.next()后if if else?
if (dc != null) {
rs = st.executeQuery("select e.env_id,s.* from env_mast e inner join"
+ " db_server_mast s on e.dc_id=s.dc_id join cust_mast c on "
+ "e.cust_id=c.cust_id where cust_name='" + env + "' and "
+ "e.dc_id='" + dc + "' ");
} else {
System.out.println("Not DC");
rs = st.executeQuery("select e.env_id,s.* from env_mast e inner join "
+ "db_server_mast s on e.dc_id=s.dc_id join cust_mast c on "
+ "e.cust_id=c.cust_id where cust_name='" + env + "' ");
}
if (rs.next()) {
}
可能是我或你的措辞很混乱。 :) – 2014-09-02 03:56:32
可能是您的匹配条件没有记录 – 2014-09-02 04:08:07