主题:求助
package appClass;
import DbMng.ConectionMng;
import java.sql.*;
import java.util.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class Person {
public void addperson(String sql) {
Connection con = ConectionMng.getConection();
try {
Statement stmt = con.createStatement();
stmt.executeUpdate(sql);
con.close();
}
catch (Exception ex) {
System.out.println("addperson error "+ex.getMessage());
}
}
public void updateperson(String sql) {
Connection con = ConectionMng.getConection();
try {
Statement stmt = con.createStatement();
stmt.executeUpdate(sql);
con.close();
}
catch (Exception ex) {
System.out.println("updateperson error "+ex.getMessage());
}
}
public void deleteperson(String sql) {
Connection con = ConectionMng.getConection();
try {
Statement stmt = con.createStatement();
stmt.executeUpdate(sql);
con.close();
}
catch (Exception ex) {
System.out.println("deleteperson error "+ex.getMessage());
}
}
public ResultSet personQuery(String condition) {
ResultSet rs =null;
//Map map = new HashMap();
String sql = "";
if (condition != null)
sql += sql + condition;
else
sql = "select * from person";
Connection con = ConectionMng.getConection();
try {
Statement stmt = con.createStatement();
rs= stmt.executeQuery(sql);
//con.close();
// map.put("rs",rs);
//map.put("con",con);
return rs;
}
catch (Exception ex) {
System.out.println("执行查询失败!" + ex.getMessage());
return null;
}
}
}
编译后程序提示以下异常,那位大哥能给我指出我错在那拉!谢谢拉!
--------------------Configuration: j2sdk1.4.2_03 <Default>--------------------
F:\appClass\Person.java:3: package DbMng does not exist
import DbMng.ConectionMng;
^
F:\appClass\Person.java:19: cannot resolve symbol
symbol : variable ConectionMng
location: class appClass.Person
Connection con = ConectionMng.getConection();
^
F:\appClass\Person.java:32: cannot resolve symbol
symbol : variable ConectionMng
location: class appClass.Person
Connection con = ConectionMng.getConection();
^
F:\appClass\Person.java:44: cannot resolve symbol
symbol : variable ConectionMng
location: class appClass.Person
Connection con = ConectionMng.getConection();
^
F:\appClass\Person.java:64: cannot resolve symbol
symbol : variable ConectionMng
location: class appClass.Person
Connection con = ConectionMng.getConection();
^
5 errors
Process completed.
import DbMng.ConectionMng;
import java.sql.*;
import java.util.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class Person {
public void addperson(String sql) {
Connection con = ConectionMng.getConection();
try {
Statement stmt = con.createStatement();
stmt.executeUpdate(sql);
con.close();
}
catch (Exception ex) {
System.out.println("addperson error "+ex.getMessage());
}
}
public void updateperson(String sql) {
Connection con = ConectionMng.getConection();
try {
Statement stmt = con.createStatement();
stmt.executeUpdate(sql);
con.close();
}
catch (Exception ex) {
System.out.println("updateperson error "+ex.getMessage());
}
}
public void deleteperson(String sql) {
Connection con = ConectionMng.getConection();
try {
Statement stmt = con.createStatement();
stmt.executeUpdate(sql);
con.close();
}
catch (Exception ex) {
System.out.println("deleteperson error "+ex.getMessage());
}
}
public ResultSet personQuery(String condition) {
ResultSet rs =null;
//Map map = new HashMap();
String sql = "";
if (condition != null)
sql += sql + condition;
else
sql = "select * from person";
Connection con = ConectionMng.getConection();
try {
Statement stmt = con.createStatement();
rs= stmt.executeQuery(sql);
//con.close();
// map.put("rs",rs);
//map.put("con",con);
return rs;
}
catch (Exception ex) {
System.out.println("执行查询失败!" + ex.getMessage());
return null;
}
}
}
编译后程序提示以下异常,那位大哥能给我指出我错在那拉!谢谢拉!
--------------------Configuration: j2sdk1.4.2_03 <Default>--------------------
F:\appClass\Person.java:3: package DbMng does not exist
import DbMng.ConectionMng;
^
F:\appClass\Person.java:19: cannot resolve symbol
symbol : variable ConectionMng
location: class appClass.Person
Connection con = ConectionMng.getConection();
^
F:\appClass\Person.java:32: cannot resolve symbol
symbol : variable ConectionMng
location: class appClass.Person
Connection con = ConectionMng.getConection();
^
F:\appClass\Person.java:44: cannot resolve symbol
symbol : variable ConectionMng
location: class appClass.Person
Connection con = ConectionMng.getConection();
^
F:\appClass\Person.java:64: cannot resolve symbol
symbol : variable ConectionMng
location: class appClass.Person
Connection con = ConectionMng.getConection();
^
5 errors
Process completed.