String b = jTextField1.getText();

     String sql = "SELECT * FROM DataImput ORDER BY InvoiceNumber=?";
     pst.setString(1, b);




    catch(Exception e){
    JOptionPane.showMessageDialog(null, e);

    } finally{
        catch(Exception e){        


this is the code I work to search. it actually work. but really weird. it show the item I want the last one. and show all items in it. how can I make it show only search data?

items = data I've enter inside

Recommended Answers

All 2 Replies

also. how to select next row by pressing a button?

your title is "Search is not working", then you say "This is the code I work to search. it actually work."

Either it works, or it doesn't.

"It show the item I want" => isn't that what your code is supposed to do? and how do you mean "the last one"?

can you be more clear? maybe you can give us an idea of the contents of your table, the value of b, the output you want and the output you actually get.

That might make it easier for us to spot the issue.

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.