0

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.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by ahmed_fawzy
0

Conn is null, obviously.

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.