📄 getfirstnamebykey.txt
字号:
public String getFirstNameByKey(String key) {
String result = new String();
Connection con = null;
con = connect();
Statement stmt = null;
ResultSet rs = null;
String select =
"SELECT * FROM ITSO." + dbtab + " WHERE lastName = '" + key + "'";
try {
stmt = con.createStatement();
rs = stmt.executeQuery(select);
while (rs.next()) {
result = rs.getString("firstName");
}
} catch (Exception e) {
System.err.println("Exception: " + e.getMessage());
} finally {
try {
if (rs != null) rs.close();
if (stmt != null) stmt.close();
if (con != null) con.close();
} catch (SQLException e) {}
}
return result;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -