The code is as follows:
Public class ClazzDao extends BaseDao {
Public List
List
String SQL="select * from s_clazz";
if(! StringUtil. IsEmpty (clazz. GetName ())) {
(this step is to judge the result is true, so the back of the if statement is skipped)
SQL +="where name like '%' + clazz. GetName () +" '";
(when forced to false, remove the data is still the id=0, name=null, info=null)
SQL +="limit" + page. GetStart () + ", "+ page. GetPageSize ();
The ResultSet ResultSet=query (SQL);
Try {
While (resultSet. Next ()) {
Clazz cl=new Clazz ();
Cl. SetId (resultSet. Get int (" id "));
Cl. Elegantly-named setName (resultSet. Get string (" name "));
Cl. SetInfo (resultSet. Get string (" info "));
Ret. Add (cl);
}
} the catch (SQLException e) {
//TODO to automatically generate the catch block of
e.printStackTrace();
}
}
return ret;
}
}
The console output:
[]
For bosses, what went wrong=-=
CodePudding user response:
The original is SQL Server cannot use limit