如题:
String url = "jdbc:informix-sqli://26.100.210.2:5000/security:INFORMIXSERVER=clafonline;NEWCODESET=GBK,8859-1,819";
String user="informix";
String password="informix";
String tmp="select * from sec_person where workcode='在岗'and personcode='保卫管理人员'"+"order by birth desc";
conn= DriverManager.getConnection(url,user,password);
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery(tmp);
rs.first();下面是我胡乱写的,我的算法是,刚才不是取了第一个记录了么,然后以第一个记录集的字段ID为条件,再次查询,然后得到结果集,并作出判断--workcode不等于“解聘”“退休”,数据有效,否则就无效。
想问的就是以ID再次查询同一数据表怎么写呀,请详细点
//String id=rs.getString("id");
//conn.close();
//String tmp2="select * from sec_person where id ='"+id+"'";
//conn= DriverManager.getConnection(url,user,password);
//stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
//rs=stmt.executeQuery(tmp2);
//String workcode=rs.getString("workcode");
String url = "jdbc:informix-sqli://26.100.210.2:5000/security:INFORMIXSERVER=clafonline;NEWCODESET=GBK,8859-1,819";
String user="informix";
String password="informix";
String tmp="select * from sec_person where workcode='在岗'and personcode='保卫管理人员'"+"order by birth desc";
conn= DriverManager.getConnection(url,user,password);
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery(tmp);
rs.first();下面是我胡乱写的,我的算法是,刚才不是取了第一个记录了么,然后以第一个记录集的字段ID为条件,再次查询,然后得到结果集,并作出判断--workcode不等于“解聘”“退休”,数据有效,否则就无效。
想问的就是以ID再次查询同一数据表怎么写呀,请详细点
//String id=rs.getString("id");
//conn.close();
//String tmp2="select * from sec_person where id ='"+id+"'";
//conn= DriverManager.getConnection(url,user,password);
//stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
//rs=stmt.executeQuery(tmp2);
//String workcode=rs.getString("workcode");
算法是:
如何不是“解聘”“退休”“进修”的话,数据就无效,否则数据有效,插入进数据库中
该怎么比较呀
select workcode where id in( select id from sec_person where workcode='在岗'and personcode='保卫管理人员'")
可以得到workcode,然后再判断
java交流群(QQ群:45459926),有意思的可以加入
然后用了equals就解决了,完全可以实现其功能!