死活看不懂QAQ//统计数据库中所有公交站点名,存入数组,返回站点名publicString[]getStation(){Stringsql="select*frombus";//groupbystation_name";//建表时注意统一,一会看看重名的...
死活看不懂 QAQ
// 统计数据库中所有公交站点名,存入数组,返回站点名
public String[] getStation() {
String sql = "select * from bus ";// group by station_name";//建表时注意统一,一会看看重名的影响
station_name[count] = rs.getString("station_name");// 建表时注意统一
public String[] getBusline() {
String busline[] = new String[1000];// 这个一千就够了吧--------------------
String sql = "select * from bus";// group by busline";
busline[count] = rs.getString("busline");// 建表时注意统一
public String[] stationPerLine(String line) {
String station_per_line[] = new String[1000];// 一个公交1000个站点够了吧
String sql = "select * from bus where busline ='line'";// 建表时注意统一
station_per_line[count] = rs.getString("station_name");
// 统计经过某站点的所有公交车的组合, 需要参数station,表示经过的站点, 返回公交线路
public String[] linePerStation(String station) {
String line_per_station[] = new String[1000];
String sql = "select * from bus where station_name = 'station' ";
int count = 0;
stm = conn.createStatement();
rs = stm.executeQuery(sql);
while (rs.next()) {
line_per_station[count] = rs.getString("station_name");
count++;
}
}
return line_per_station;
中间的算法可以无视,我只想知道怎么编数据库的字段,各位帮帮忙吧QAQ
展开