Re: Exception on Result Sets
Richard Masters <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
Rafael, You should do a rs.next() before performing any get methods on the ResultSet. >From: Rafael Chiarinelli <[email protected]> >Reply-To: "A mailing list for discussion about Sun Microsystem's Java > Servlet API Technology." <[email protected]> >To: [email protected] >Subject: Exception on Result Sets >Date: Thu, 13 Mar 2003 00:53:54 -0300 > > >Hi all, > >I'm developing a SERVELT for a WebPage and when I try to get a String of a >ResultSet, occurs the following exception: > >Java.SQL.SQLException : Before start of Result Set > >This is the code's part with bug: > > try { > Class.forName("org.gjt.mm.mysql.Driver").newInstance(); > conexao = >DriverManager.getConnection("jdbc:mysql://localhost/Database?user=root&password="); > > st1 = conexao.createStatement(); > st2 = conexao.createStatement(); > st3 = conexao.createStatement(); > IDTemp = request.getParameter("id"); > IDTC=Integer.parseInt(IDTemp); > ResultSet rs = st1.executeQuery("SELECT * FROM classifgeral WHERE >IDTC="+ IDTC); > ResultSet rs2 = st2.executeQuery("SELECT * FROM tipo_classificado >WHERE IDTC="+ IDTC); > IDVS=rs.getInt("idvs"); > ResultSet rs3=st3.executeQuery("SELECT * FROM cad_visitantes WHERE >id ="+ IDVS); > tipClass=rs2.getString("TIPO"); > descClass=rs2.getString("DESCRICAO"); > >Somebody has a idea? > >Regards, > >Rafael Chiarinelli > > > >--------------------------------- >Busca Yahoo! >O serviço de busca mais completo da Internet. O que você pensar o Yahoo! >encontra. _________________________________________________________________ Overloaded with spam? With MSN 8, you can filter it out http://join.msn.com/?page=features/junkmail&pgmarket=en-gb&XAPID=32&DI=1059 ___________________________________________________________________________ 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