日期:2014-05-17 浏览次数:20782 次
String sql="select * from users where userID between "+num1+" and "+num2;
String sql="select * from (" +"select top "+num1+" * from " +"(select top "+num2+" * from users order by userID) a " +"order by a.userID desc" +") b order by b.userID";
String sql="select * from " +"( " +"select t.* , (select count(userID) from users where userID < t.userID) + 1 px from users t" +") m " +"where px between "+num1+" and "+num2;
String sql="select * from (" +"select *,px=(select count(1)+1 from users where userID<t.userID) from users t " +") tt " +"where px between "+num1+" and "+num2;
String sql="select count(userID) as sum from users";
package dao; import java.sql.CallableStatement; import java.sql.Connection; import util.MyConnection; public class GbDao { private Connection conn = null; private CallableStatement cs=null; public void initConnection() throws Exception { MyConnection myconn= new MyConnection(); //初始化MyConnection对象 conn = myconn.getConnection(); //调用MyConnection的getConnection()方法得到数据库连接 } public String gbht(String gwm,String zmlm){ String msg=null; String sql="{?=call F_HD_GBHT(?,?)}"; System.out.println("sql="+sql); try{this.initConnection(); CallableStatement cs=conn.prepareCall(sql); cs.registerOutParameter(1, java.sql.Types.VARCHAR); cs.setString(2, gwm); cs.setString(3, zmlm); cs.execute(); msg=cs.getString(1); }catch(Exception ex){ ex.printStackTrace(); }finally{ try{ if(cs!=null){ cs.close(); } }catch(Exception ex){ ex.printStackTr