why when i write this down :

private Statement getOrders_st=null;
 
    public ResultSet getOrders(String UserName)
    {
        ResultSet Rs=null;
      try
      {
          getOrders_st = Conn.createStatement();
          Rs = getOrders_st.executeQuery("select order_history , ordr_date , ordr_total from orders where ordr_userid = '"+UserName.toLowerCase()+"'");           
      }
      catch(SQLException ex)
      {
        ex.printStackTrace();
      }
       return Rs;
    }

give NullPointerException at

getOrders_st = Conn.createStatement();

If Any One Know I would Be pleased to Have The Answer.

Recommended Answers

All 2 Replies

Conn is null, obviously.

Conn is null, obviously.

Ooh Yes........Thanks For The Hint,,,,, i'm new to Java
Thank You Again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.