>Ele compila sem problemas, não gera erro de SQL mas,
>eu não sei como pegar o resultado desta consulta para saber se é true ou
>false (se o fulano existe no BD ou não).
> private boolean selectFromDB( String aux )
> {
> PrintWriter out;
> try {
>
> statement = connection.createStatement();
> statement.execute("SELECT Nome_cliente FROM Cliente WHERE
>Nome_cliente='"+aux+"';");
> statement.close();
>
> }
> catch ( Exception e ) {
> System.err.println(
> "ERROR: Problems with adding new entry" );
> e.printStackTrace();
> return false;
> }
OK,
Tente pegar o resultset - resultado da pesquisa - como no exemplo
abaixo e chamar o método next:
ResultSet rs = stmt.executeQuery("SELECT COF_NAME,
PRICE FROM COFFEES");
if (!rs.next()) {//Não retornou nada}
Consulte o Tutorial JDBC no Site da SUN para mais informações:
Trecho tirado do Tutorial JDBC da SUN:
... Since the cursor is initially positioned just above the first row of a
ResultSet object, the first call to the method next moves the cursor to the
first row and makes it the current row. Successive invocations of the method
next move the cursor down one row at a time from top to bottom. ...
[]
Adriano
___________________________________________________
Adriano Pinho
Powerlogic Team
http://www.powerlogic.com.br
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
------------------------------ LISTA SOUJAVA ----------------------------
http://www.soujava.org.br - Sociedade de Usuários Java da Sucesu-SP
dúvidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
para sair da lista: envie email para [EMAIL PROTECTED]
-------------------------------------------------------------------------