Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
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:
JDBC and Relational Databases
how to bind jtable with mssql database table using netbeans 6.5
amrish sharma
Greenhorn
Posts: 20
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
if any one have a solution please provide me
thanks
Fatih Keles
Ranch Hand
Posts: 182
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You may find
this
tutorial useful to do things from the first place. But I don't know if there is an easy way of doing this in netbeans.
Regards,
Fatih.
amrish sharma
Greenhorn
Posts: 20
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
ya i know that way but i want to know the way it is done in netbeans Gui
actually i am using jcombobox for sending table name param and jtable for fetching table data
amrish sharma
Greenhorn
Posts: 20
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
my code is this but it didnt return first row of the table i dont know why please help thanks I am using Ms Sql Server 08 as backend thanks
public void hrows() { try { limitconnector.connector.ch();//jdbc odbc connectivity cls Connection conn=connector.con;//jdbc odbc connectivity cls String queryx="select * from "+tablenaam.getSelectedItem().toString().trim();//jcombobox Vector v = new Vector(); PreparedStatement ps = conn.prepareStatement(queryx,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); ResultSet rss=ps.executeQuery(); rss.next(); ResultSetMetaData rsmd = rss.getMetaData(); int colno = rsmd.getColumnCount(); for(int j=1;j<=colno;j++) { String col = rsmd.getColumnName(j); v.addElement(col.trim()); // System.out.println(col); } String colnames[] = new String[v.size()]; for(int j=0;j<colnames.length;j++) { colnames[j]=v.get(j).toString(); } DefaultTableModel model = new DefaultTableModel(); model.setColumnIdentifiers(colnames); model.setRowCount(0); while(rss.next()) { Object[] row = new Object[colno]; // System.out.println(colno+"");//col=3 for(int i=0;i<colno;i++) { row[i]=rss.getObject(i+1).toString().trim(); //System.out.println(i+""); } model.addRow(row); } dataviewer.setModel(model); conn.close(); ps.close(); } catch(Exception e) { System.out.println("Error :" + e); } }
Fatih Keles
Ranch Hand
Posts: 182
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Remove line 14
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
binding two JTables to each other
database application problem with jtable binding
create JTable
JTable(!!!)
JTable
More...