Wrong number of database records is output by a Java program

I have a table in mySQL and has 3 line which has name ,address,Telephone,Age,Charge. in two of them the names are "Adam" and the last row is "Abas" ,i don't know that why it prints in the console like this,please help me thanks! Statement s; int s4,s5;String s1,s2,s3; List clientList = null; try { s = conn.createStatement(); ResultSet rs = s.executeQuery("SELECT * FROM customer_info WHERE Name LIKE 'A%'"); InfoClass list = null; while (rs.next()) { s1 = rs.getString(2); if (rs.wasNull()) { s1 = null; } s2 = rs.getString(3); if (rs.wasNull()) { s2 = null; } s3 = rs.getString(4); if (rs.wasNull()) { s3 = null; } s4 = rs.getInt(5); if (rs.wasNull()) { s4 = 0; } s5 = rs.getInt(6); if (rs.wasNull()) { s5 = 0; } list = new InfoClass(s1, s2); if (clientList == null) { clientList = new ArrayList(); } clientList.add(list); } for(int i=0;iYour question is extremely confused. Please post the table structure, and the contents of the table. Also, please ask a specific question. What output did you expect? What part surprises you? Without a specific question, your question entry will be closed quickly.

以上就是Wrong number of database records is output by a Java program的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准