NullPointerException PreparedStatement
Exception in thread "main" java.lang.NullPointerException
at dao.StoreDao.query(StoreDao.java:64)
(64)//PreparedStatement ptmt = conn.prepareStatement(sb.toString());
at test.TestAction.main(TestAction.java:33)
(33)//List<StoreMoudle> gs = g.query();
conn代碼//public static Connection getConnection(){
? ?return conn;
}
2017-07-01
空指針異常,說明你里面屬性的值是空 ?但是還是使用了 要不是sb這個沒有值 ?要不就是下面的list需要List<StoreMoudle> gs ? 需要這樣寫?List<StoreMoudle> gs =new arrylist<StoreMoudle>();然后在gs=g.query