ResultSet rs=con.getRs("SELECT a.jobid,b.name,b.school,b.specialty,b.knowledge,a.job,a.emolument FROM tb_sjob AS a,tb_student AS b WHERE a.sname=b.sname and getdate()<=atime ORDER BY ptime DESC");想知道这代码能怎么修改。否则rs永远是个NULL值。
数据库方面没问题。
数据库方面没问题。
解决方案 »
- 框架集成,页面访问action时,报了这个错误,请问,如何解决,急用???
- 关于Struts2 NameSpace的一点疑问
- 怎么jsp request的数据传不过去呢
- struts标签
- 如何对Cooike进行加密码!!
- 访问一张图片的时候都会发生错误!而且是毫无相关的错误,想不出为什么!
- Session莫名丢失得问题!
- 请教各位,在实现三层结构时,各个层次的开发大家都采用些什么技术啊?(用JAVA开发的)
- 这一句import javax.servlet.*;在书上说可以,为什么在我用EDITPLUS 编译时出错,?,应怎么办?(出错信息如内)
- 急!!我的页面提交不了用jsp???????
- 网页发布问题:unbuntu环境下Tomcat显示乱码
- 求助 修改基于GWT制作的GUI
b.name,
b.school,
b.specialty,
b.knowledge,
a.job,
a.emolument
FROM tb_sjob AS a, tb_student AS b
WHERE a.sname = b.sname
and getdate() <= atime
ORDER BY ptime DESC
执行看看要是空的话,先试试把一些where条件去掉试试。。
package com.bwm.db;import java.sql.*;/**
*class explain:Database connection
*set up name: crazyadept
*set up time: 11/22/2004
*/
public class Conn {
private static Connection con;
private Statement stmt;
private ResultSet rs;
private static final String drivername =
"com.microsoft.sqlserver.jdbc.SQLServerDriver";
private static final String url = "jdbc:microsoft://127.0.0.1:1433;DatabaseName=db_Job;user=sa;password=;"; /**
*method explain: Get Connection DataBase
*modify time: 12/20/2004
*/
public static synchronized Connection getCon() throws Exception {
try {
Class.forName(drivername);
con = DriverManager.getConnection(url);
return con;
} catch (SQLException e) {
System.err.println(e.getMessage());
throw e;
}
} /**
*output parameter: in order select in SQL
*modify time: 12/20/2004
*/
public Statement getStmtread() {
try {
con = getCon();
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
return stmt;
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
return null;
} /**
*output parameter: Data
*input parameter: SQL select sentence
*modify time: 11/29/2004
*/
public ResultSet getRs(String sql) {
try {
stmt = getStmtread();
rs = stmt.executeQuery(sql);
return rs;
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
return null;
} /**
*output parameter: not in order select in str SQL
*modify time: 11/29/2004
*/
public Statement getStmt() {
try {
con = getCon();
stmt = con.createStatement();
return stmt;
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
return null;
} /**
*method explain: Close DataBase Connection
*modify time: 11/29/2004
*/
public synchronized void close() {
try {
if (rs != null) {
rs.close();
rs = null;
}
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
try {
if (stmt != null) {
stmt.close();
stmt = null;
}
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
try {
if (con != null) {
con.close();
con = null;
}
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
}
}