java,sql;;String name = res.getString("name");如何把查询到的结果存入一个string数组中?? 10
publicstaticvoidchaxunshujuku(){//简单查询baite_select_readerc=newbaite_select_reader();/...
public static void chaxunshujuku() { // 简单查询
baite_select_reader c = new baite_select_reader(); // 创建本类对象
con = c.getConnection(); // 与数据库建立连接
try {
sql = con.createStatement();
res = sql
.executeQuery("SELECT Name FROM Master..SysDatabases ORDER BY Name");
while (res.next()) {
String name = res.getString("name");
System.out.println( name );
}
} catch (Exception e) {
e.printStackTrace();
}
} 展开
baite_select_reader c = new baite_select_reader(); // 创建本类对象
con = c.getConnection(); // 与数据库建立连接
try {
sql = con.createStatement();
res = sql
.executeQuery("SELECT Name FROM Master..SysDatabases ORDER BY Name");
while (res.next()) {
String name = res.getString("name");
System.out.println( name );
}
} catch (Exception e) {
e.printStackTrace();
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询