[Solved] I want to search for a product by its name and display the name and selling price in a JTextField in java [closed]


When you use a PreparedStatement you need to replace each “?” with a valid value before doing the actual query.

So the basics of the code would be:

String sql = "Select * from SomeTable where SomeColumn = ?";

PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setString(1, someColumnVariable);

ResultSet rs = stmt.executeQuery();

solved I want to search for a product by its name and display the name and selling price in a JTextField in java [closed]