拼接sql

时间:2014-12-16 14:53:58   收藏:0   阅读:328

String whereArgs = taskTable + " where 1=1 ";

if (upCheck) {
whereArgs += " and type = 2 ";
}
if (gameID != null && !gameID.equals("0")) {
whereArgs += " and gameID = " + gameID;
}
if (searchProjectkey != null && !searchProjectkey.trim().equals("")) {
whereArgs += " and projectID like " + "‘%" + searchProjectkey
+ "%‘";
}
if (searchChannelkey != null && !searchChannelkey.trim().equals("")) {
whereArgs += " and channelName like " + "‘%" + searchChannelkey
+ "%‘";
}

原文:http://www.cnblogs.com/CaptainLin/p/4166927.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!