【发布时间】:2012-08-02 05:34:22
【问题描述】:
我已经尝试开发计数值显示在我的 apache-tomcat 控制台窗口上。 这里使用以下代码:
public class RetailerWs {
public int data(){
int count=0;
count++;
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pro","root","");
PreparedStatement statement = con.prepareStatement("select * from orders where status='Q' AND date=CURDATE()");
ResultSet result = statement.executeQuery();
}
catch(Exception exc){
System.out.println(exc.getMessage());
}
return count;
}
}
我的另一门课是:
public class Demo {
public static void main(String[] args){
RetailerWs obj = new RetailerWs();
System.out.println(obj.data());
}
}
在我的数据库中有2个值与上面的查询匹配。但显示的输出总是1。为什么这里发生dis错误。请帮助我这里使用什么循环条件。给我一些解决方案。
【问题讨论】:
标签: java mysql apache tomcat soap