当前位置: 技术问答>java相关
result的问题
来源: 互联网 发布时间:2015-05-17
本文导语: String sqlseed="select seed from manager where name = '" + name + "' and list = '" + list +"' ;" ; String sqliteration="select iteration from manager where name = '" + ...
String sqlseed="select seed from manager where name = '" + name
+ "' and list = '" + list +"' ;" ;
String sqliteration="select iteration from manager where name = '" +
name + "' and list = '" + list +"' ;" ;
ResultSet seed=stmt.executeQuery(sqlseed);
ResultSet iteration=stmt.executeQuery(sqliteration);
resuleset返回的是什么,如果是结果,是字符串吗?如果是字符串,为什么
不能string seed123=seed;
请各位指教。
+ "' and list = '" + list +"' ;" ;
String sqliteration="select iteration from manager where name = '" +
name + "' and list = '" + list +"' ;" ;
ResultSet seed=stmt.executeQuery(sqlseed);
ResultSet iteration=stmt.executeQuery(sqliteration);
resuleset返回的是什么,如果是结果,是字符串吗?如果是字符串,为什么
不能string seed123=seed;
请各位指教。
|
ResultSet返回的是一串结果集,下面给你个例子:
String askType;
String askInfo;
Statement smt = con.createStatement();
/* 按顺序读取第一条待发短信 */
String selCode = "SELECT TOP 1 AskType,AskInfo " +
"FROM AskSubmitInfo " +
"ORDER BY LeReferTime ASC";
ResultSet r = smt.executeQuery(selCode);
while(r.next()) {
askType = r.getString("AskType");
askInfo = r.getString("AskInfo");
}//取出ResultSet的结果,只有一条记录
String askType;
String askInfo;
Statement smt = con.createStatement();
/* 按顺序读取第一条待发短信 */
String selCode = "SELECT TOP 1 AskType,AskInfo " +
"FROM AskSubmitInfo " +
"ORDER BY LeReferTime ASC";
ResultSet r = smt.executeQuery(selCode);
while(r.next()) {
askType = r.getString("AskType");
askInfo = r.getString("AskInfo");
}//取出ResultSet的结果,只有一条记录