Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
how to add new row in jtable
Sudhir Pawar
Greenhorn
Posts: 25
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
below i have given
java
code which read all data from database on key released event successfully and also stored into variables(in while loop) but i am not able to add new row in jtable.
please give me solution for this problem
textField.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { search(); } }); void search() { try { String x; x=textField.getText(); System.out.println(x); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","hr"); Statement stmt = con.createStatement(); //code to search company as per user press keys String comp_name = textField.getText(); String sql= "select * from invoicecompany where CNAME like '"+ comp_name + "%' " ; System.out.println("sql:" +sql); ResultSet rsf =stmt.executeQuery(sql); int sr_no=0; DefaultTableModel cfjt = (DefaultTableModel) Comp_Find_jtable.getModel(); while(rsf.next()) { sr_no++; Vector v = new Vector(); String cname = rsf.getString(2); int ino = Integer.parseInt(rsf.getString(7)); int ono = Integer.parseInt(rsf.getString(17)); int gt = Integer.parseInt(rsf.getString(16)); String date = rsf.getString(8); v.add(0, cname); v.add(1,ino); v.add(2,ono); v.add(3,gt); v.add(4,date); cfjt.insertRow(sr_no, v); // problem is here not able to add new row in jtable } } catch (Exception ex) { ex.printStackTrace(); } }
Steve Luke
Bartender
Posts: 4179
22
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Sudhir Pawar wrote:
please give me solution for this problem
What is the problem? Please
TellTheDetails
so we know how to answer.
Steve
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How can I add rows in a Jtable
JTable Problem
Jtable problem
JTable ClassCastException: Add rows dynamically
JTable problem
More...