Asp.net 链接mySQL 使用like查询mysql 查询器中正常 asp.net 返回没有结果,问各位大神这是为什么?
2 回答
12345678_0001
TA贡献1802条经验 获得超5个赞
StringBuilder sb = new StringBuilder(); sb.Append("select * from Friend_UserSiteInfo where IsDel=0"); StringBuilder sbCondition = new StringBuilder(); if (friendID != 0) { sbCondition.AppendFormat(" AND FriendID={0}", friendID); } if (!string.IsNullOrEmpty(friendSiteName)) { sbCondition.AppendFormat(" AND FriendSiteName Like '%{0}%'",friendSiteName); } if (type !=0) { sbCondition.AppendFormat(" AND CooperationMode ={0}", type); } sb.Append(sbCondition.ToString()); sb.AppendFormat(" limit {0},{1} ;", ((pageIndex - 1) * pageSize), pageIndex * pageSize); sb.Append(" SELECT COUNT(0) FROM Friend_UserSiteInfo WHERE IsDel=0 "); sb.Append(sbCondition.ToString());
达令说
TA贡献1821条经验 获得超6个赞
sb.Append(sbCondition.ToString()); sb.AppendFormat(" limit {0},{1} ;", ((pageIndex - 1) * pageSize), pageIndex *pageSize);把这个
sb.Append(sbCondition.ToString());删除掉试试。写了两次了,把第一个删除掉。
添加回答
举报
0/150
提交
取消