LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1280|回复: 2

求助~~这是什么错误啊?

[复制链接]
发表于 2006-4-23 21:28:55 | 显示全部楼层 |阅读模式
完整代码如下:
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

这是什么错误啊??
发表于 2006-4-24 12:51:22 | 显示全部楼层
找不到类 DBConnection 这个应该是自定义的数据库连接类。你自己仔细看看书上应该有这个类的,得把它加进去! 
回复 支持 反对

使用道具 举报

发表于 2006-4-24 12:51:38 | 显示全部楼层
找不到类 DBConnection 这个应该是自定义的数据库连接类。你自己仔细看看书上应该有这个类的,得把它加进去! 
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表