请高手帮忙看看java程序中的错误,该怎么改啊.

来源:百度知道 编辑:UC知道 时间:2024/06/11 14:03:08
程序如下:
package com.buy.bean.coin;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.buy.bean.comm.database.DBConnect;
public class ConsumeSelectBean1 {
public ConsumeSelectBean1(){

}
public StringBuffer selectConsume(String userID) {
String condition;
condition = "select count(userid) as num, productname , sum(price) as total from consume where userid = '"+userID+"' group by productname";
ResultSet rs = null;
String name, coin, num;
Statement sql = null;
StringBuffer buffer = new StringBuffer();
try {
Connection conn = DBConnect.getConnection();
sql = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
rs = sql.executeQuery(condition);
while (rs.next()) {
num = rs.getString(1);

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.buy.bean.comm.database.DBConnect;
public class ConsumeSelectBean1 {
public ConsumeSelectBean1(){

}
public void selectConsume(String userID) {

String totalStr=null;
String condition;
condition = "select count(userid) as num, productname , sum(price) as total from consume where userid = '"+userID+"' group by productname";
ResultSet rs = null;
String name, coin, num;
Statement sql = null;
StringBuffer buffer = new StringBuffer();
try {
Connection conn = DBConnect.getConnection();
sql = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
rs = sql.executeQuery(condition);
while (rs.next()) {
num = rs.getString(1);
name = rs.getString(2);
coin = rs.