?? osinfo.java
字號:
package scout.operation.out_scout;
import scout.util.*;
import scout.database.util.*;
import java.sql.*;
import java.util.*;
/**
* <p>Title: 野外監測</p>
*
* <p>Description: 取值</p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: Chongqing Kemeida corporation</p>
*
* @author
* @version 1.0
*/
public class OsInfo {
public OsInfo() {
}
/** 返回某id的所有數據信息 */
public IntOsInfo getIdInfo(String id) {
IntOsInfo u = new IntOsInfo();
try {
ConnDataBase db = new ConnDataBase();
Connection conn = db.getConnection();
//QueryData qd = new QueryData(conn);
//讀取userLogin數據并增加到UserInfo類中。
String sql = "select * from fieldnote where ID ='" + id + "'";
System.out.println("sql: " + sql);
Statement s = conn.createStatement();
ResultSet rs = s.executeQuery(sql);
while (rs.next()) {
u.setScoutSite(Tools.formatStr(rs.getString("scoutSite")));
u.setScoutAddr(Tools.formatStr(rs.getString("scoutAddr")));
u.setX(rs.getInt("x"));
u.setY(rs.getInt("y"));
u.setZ(rs.getInt("z"));
u.setScoutMan(Tools.formatStr(rs.getString("scoutMan")));
u.setScoutdate(rs.getDate("scoutdate"));
u.setHabitatCharacter(Tools.formatStr(rs.getString("habitatCharacter")));
u.setRemark(Tools.formatStr(rs.getString("remark")));
}
rs.close();
s.close();
conn.close();
} catch (Exception ex) {
ex.printStackTrace();
}
return u;
}
/** 返回某ID的所有數據信息 */
public IntOsInfo getIdInfo1(String id) {
IntOsInfo u = new IntOsInfo();
try {
ConnDataBase db = new ConnDataBase();
Connection conn = db.getConnection();
Statement s = conn.createStatement();
//讀取數據并增加到UserInfo類中。
String sql =
"select * from fieldnote as a,animalnote as b where a.ID = b.fieldNoteID " +
"and a.ID =" + id;
System.out.println("sql: " + sql);
ResultSet rs = s.executeQuery(sql);
while (rs.next()) {
u.setAID(rs.getInt("id"));
u.setFieldNoteID(rs.getInt("fieldNoteID"));
u.setClassAnimal(Tools.formatStr(rs.getString("classAnimal")));
u.setClassNumber(rs.getInt("classNumber"));
u.setClassCharacter(Tools.formatStr(rs.getString("classCharacter")));
u.setSymptom(Tools.formatStr(rs.getString("symptom")));
u.setDeadNumber(rs.getInt("deadNumber"));
u.setOtherNumber(rs.getInt("otherNumber"));
u.setFirstConclusion(Tools.formatStr(rs.getString("firstConclusion")));
u.setSampling(rs.getInt("sampling"));
u.setLocaleDisposal(Tools.formatStr(rs.getString("localeDisposal")));
}
rs.close();
s.close();
conn.close();
} catch (Exception ex) {
ex.printStackTrace();
}
return u;
}
public static void main(String[] args) {
OsInfo op = new OsInfo();
IntOsInfo u = new IntOsInfo();
u = op.getIdInfo("5");
System.out.println("ID:" + u.getID());
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -