155 |
return result; |
return result; |
156 |
|
|
157 |
} |
} |
158 |
|
public static String getStationName(int stationID) { |
159 |
|
String station = ""; |
160 |
|
|
161 |
|
Connection conn = null; |
162 |
|
try { |
163 |
|
conn = DBConnection.getConnection(); |
164 |
|
Statement stmt = conn.createStatement(); |
165 |
|
ResultSet rs = stmt.executeQuery("SELECT name FROM trainstations WHERE id=" + stationID); |
166 |
|
if (rs.next()) { |
167 |
|
station = rs.getString(1); |
168 |
|
} |
169 |
|
|
170 |
|
} catch (Exception e) { |
171 |
|
} finally { |
172 |
|
try { |
173 |
|
if (conn != null && !conn.isClosed()) |
174 |
|
conn.close(); |
175 |
|
} catch (Exception e) {} |
176 |
|
} |
177 |
|
|
178 |
|
return station; |
179 |
|
} |
180 |
} |
} |