完整代码如下:
package bookstore;
import java.sql.*;
public class UserList
{
//获取HTML下拉框的用户列表代码
public static String getUserListHTML() {
Connection conn = null;
StringBuffer sBuf = new StringBuffer();
try {
conn = DBConnection.getConnection();
PreparedStatement pStat = conn.prepareStatement(
"select id,admin from web_admin");
ResultSet rs = pStat.executeQuery();
while (rs.next()) {
sBuf.append("<option value='" + rs.getString("id") + "'>" +
rs.getString("admin") + "</option>\n");
}
return sBuf.toString();
} catch (SQLException ex) {
ex.printStackTrace();
return "";
} finally {
try {
if (conn != null) {
conn.close();
conn = null;
}
} catch (SQLException ex1) {
}
}
}
}
编译提示:
"UserList.java": cannot find symbol; symbol : variable ODBConnection, location: class bookstore.UserList at line 11, column 8
这是什么错误啊?? |