我如何把我select * from biao的植放到hashmap里,然后有怎么样把他一条一条的取出来呢??请大家帮帮忙,谢谢,谢谢,谢谢,谢谢谢谢,谢谢谢谢, http://www-900.ibm.com/developerWorks/cn/java/j-jtp08223/index.shtml 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public class MyDB{ private int year; private String str; public MyDB(int ye,String s) { year=ye; str=s; }}public Collection getDB(){ List cars=new ArrayList(); Connection conn=null; Statement stat=null; ResultSet rs=null; try( conn=dataSource.getConnection(); stat=conn.createStatement(); rs=stat.executeQuery("sql语句"); while(rs.next()) { int year=rs.getInt("1"); String str=rs.getString("2"); cars.add(new MyDB(year,str)); } return cars; }catch(Exception e0 { e.printStackTrace(); }} 不太清楚楼主的意思放到hashmap的话,要求键-值对能唯一确定如果你不同记录对应的一个图的话,你怎么往hashmap里放? http://www.zdnet.com.cn/developer/code/story/0,2000081534,39111995,00.htmhttp://www2.tw.ibm.com/developerWorks/tutorial/SelectTutorial.do?tutorialId=182帮你找了两篇文章,希望对你有用/ HashMap hash=new HashMap();hash.put("asdf","asdfsdf");hash.put("asdf","asdfsdf");System.out.println(hash.size());//size=1;jdk不报错HashMap hash=new HashMap();hash.put("asdf1","图1");hash.put("asdf2","图1"); hibernate存储一个对象的时候出现问题 MYECLIPSE7.1+JBOSS TOOLS 开发JSF问题,请教使用过JBOSS TOOLS的人回答 java源代码反向生成uml类图 jsp: forward的jsp:param参数传递问题,虽然经典但请大家看好再回,别高兴得太早也不要紧张哈 js答疑 怎么在上传的图片的input框中显示路径 十万火急急急!!!!! 请问如何用程序来查询出一条曲线图中相似的节点 做过新浪微博接口的来看看 求救:TOMCAT出了问题 一名大一学生求助,无奈了。。。。 请问大家一个路径的问题? JB建立exe文件的问题
{
private int year;
private String str;
public MyDB(int ye,String s)
{
year=ye;
str=s;
}
}public Collection getDB()
{
List cars=new ArrayList();
Connection conn=null;
Statement stat=null;
ResultSet rs=null;
try(
conn=dataSource.getConnection();
stat=conn.createStatement();
rs=stat.executeQuery("sql语句");
while(rs.next())
{
int year=rs.getInt("1");
String str=rs.getString("2");
cars.add(new MyDB(year,str));
}
return cars;
}catch(Exception e0
{
e.printStackTrace();
}
}
放到hashmap的话,要求键-值对能唯一确定
如果你不同记录对应的一个图的话,你怎么往hashmap里放?
http://www2.tw.ibm.com/developerWorks/tutorial/SelectTutorial.do?tutorialId=182
帮你找了两篇文章,希望对你有用/
hash.put("asdf","asdfsdf");
hash.put("asdf","asdfsdf");
System.out.println(hash.size());//size=1;jdk不报错
HashMap hash=new HashMap();
hash.put("asdf1","图1");
hash.put("asdf2","图1");