Skip to content
Advertisement

Reading data from mysql database using java

Firstly, I’m reading the product name and number of products from user using jTextFields. For that product I read the product id and price from database using sql query. But in the below code I display the product price in a jtextField but while running tha file I get query executed successfully but I’m not getting anything in the jtextField.

And please check the sql query and resultset use, table name is “item” and database name is “myshop”, I declared variables globelly and this code is in a jButton’s ‘ActionPeformed” part.

JavaScript

Advertisement

Answer

you would need to take item_name as param and put in quotes,

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement