这是从数据库获取当前日期信息的代码。它正在成功运行。
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();
while(result.next()) {
// Do something with the row returned.
count++; //if the first col is a count.
}
}
catch (Exception exc) {
System.out.println(exc.getMessage());
}
return count;
}
}
我的疑问是如何从数据库中获取当前月份的详细信息。..怎么做...请帮助我。
dis 是我的数据库:
在这里我希望输出是如果我运行上述应用程序意味着它显示计数值。如果我希望输出是当前月份的详细信息。例如:我获取当前日期信息意味着检查查询并显示计数值为 2 ..它工作成功。在这里我写的查询是
select * from orders where status='Q' AND date=CURDATE()".
它成功地工作了。同样的事情是如何为当前月份的 status=Q 编写查询...所以现在我希望显示输出为 2.但我无法执行 dis.所以请帮助我。怎么样to do.how 我怎样才能改变我的代码。