You guys are probably going to think I'm crazy, but if you could check my work here, I would be much obliged. I just need to check the java. Here is the sql string that I need produced:
Here is the java code that I have:
I've looked it over about 10 times. The sql string returns 23 results when I try it on the 400. I'm pretty sure that the string is okay. I'm just unsure about the code, because the search will return results, they're just incorrect. They have nothing to do with the search criteria entered.
By the way, my server has decided to work pretty well. The only thing is when it is running, everything runs very slowly. However, the application will run now without WDSC hanging up. It takes about 2 full minutes from the time that I select "run on server" to show the results. Is this typical?
Code:
SELECT tdydno, tdload, tltype, tlacctno, taname, tlcymd, tlamount, tdstatus, tdsrn FROM SCF031J3 WHERE tdstatus='C' AND ucase (taname) LIKE ucase ('% name%') AND ucase(tacity) LIKE ucase ('%city%') AND ucase(tastate) LIKE ucase ('%state%') ORDER BY tlcymd DESC
Code:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { Connection opnConn = ConnDB.opnAS400Conn(); List beanList = new ArrayList(); StringBuffer sql = new StringBuffer(); sql.append("SELECT tdydno, tdload, tltype, tlacctno, taname, tlcymd, tlamount, tdstatus, tdsrn FROM SCF031J3 WHERE tdstatus='C' "); if(!"".equals(request.getParameter("name"))) {} else { sql.append("AND ucase(taname) LIKE ucase ('%"); sql.append(request.getParameter("name")); sql.append("%')"); } if(!"".equals(request.getParameter("city"))) {} else { sql.append("AND ucase(tacity) LIKE ucase ('%"); sql.append(request.getParameter("city")); sql.append("%')"); } if(!"".equals(request.getParameter("state"))) {} else { sql.append("AND ucase(tastate) LIKE ucase ('%"); sql.append(request.getParameter("state")); sql.append("%')"); } if(!"".equals(request.getParameter("item"))) {} else { sql.append("AND ucase(tditem) LIKE ucase ('%"); sql.append(request.getParameter("item")); sql.append("%')"); } sql.append(" ORDER BY tlcymd DESC"); ResultSet MyQuery = ScrapSearchRS.myRS(sql.toString(), opnConn); while(MyQuery.next()) { BeanScrapSearch infoBean = new BeanScrapSearch(); infoBean.setYard(MyQuery.getString("tdydno")); infoBean.setLoad(MyQuery.getString("tdload")); infoBean.setType(MyQuery.getString("tltype")); infoBean.setAcctno(MyQuery.getString("tlacctno")); infoBean.setName(MyQuery.getString("taname")); infoBean.setDate(MyQuery.getString("tlcymd")); infoBean.setAmount(MyQuery.getString("tlamount")); infoBean.setStatus(MyQuery.getString("tdstatus")); infoBean.setSrn(MyQuery.getString("tdsrn")); beanList.add(infoBean); } request.setAttribute("beanList", beanList); getServletContext().getRequestDispatcher ("Results.jsp").forward(request,response); } catch(Exception e) { e.printStackTrace(); } }
I've looked it over about 10 times. The sql string returns 23 results when I try it on the 400. I'm pretty sure that the string is okay. I'm just unsure about the code, because the search will return results, they're just incorrect. They have nothing to do with the search criteria entered.
By the way, my server has decided to work pretty well. The only thing is when it is running, everything runs very slowly. However, the application will run now without WDSC hanging up. It takes about 2 full minutes from the time that I select "run on server" to show the results. Is this typical?
Comment