Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Java
try
{          
    String query="insert into category_2 (catname)values(?)";

    pst=conn.prepareStatement(query);
    pst.setString(1,jTextField18.getText());
    pst.execute();	

    JOptionPane.showMessageDialog(null,"Category Added Sucessfully");
    pst.close();
} catch (Exception e1)
{
    e1.printStackTrace();
}
Posted
Updated 2-Dec-14 23:31pm
v4
Comments
Member 11282270 3-Dec-14 3:48am    
help me

1 solution

So you add the catagory field. If the table category_2 has an auto field and catname has a unique index, then you could continue by querying the table; hard I know. If not then you need to get the value from somewhere. If it is the total number of catagories then select count(catname) from category_2 is the query you need or else you could generate the number in your code.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900