You'll also have to initialize the ResultSet rs besides the Statement  (st)
and the Connection con, like Jim already stated.

P.S. Little remark here: it looks to me that val is a string representing a
value and not a variable. in that case I expect you'll going to get a
SQLException! Put the val between quotes.

Good Luck.

-----Oorspronkelijk bericht-----
Van: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]Namens lramirez
Verzonden: Wednesday, July 05, 2000 11:15 PM
Aan: [EMAIL PROTECTED]
Onderwerp: java.lang.NullPointerException:


Hi !!! I wrote the following Code and i got a problem !!!
its a method that returns a resultset, but id doesnt work on !!!

public ResultSet give_results (String  val)
 {
 String chain;
  try
  {
  chain="select id_reporte from reportes where id_is = " + val ;
  System.out.println("Voy para alla con " + cadena );
  rs = st.executeQuery(chain); // RIGHT HERE IT GIVES ME THE ERROR

!!!!!!!!!!!!!!!!(JAVA.LANG.NULLPOINTEREXCEPTION !!!! )

  System.out.println("el resultset tiene: "+ rs.getRow() );
  return rs;
  }
  catch (Exception e)
  {
   System.out.println("Error en Resultset: "+ e );
  }
 }

>From what i have read, its because i haven initialized the recordset or
statement class.
is it rght ???

thanks a lot !!!

Luis

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to