| |
|
Welcome to KnowledgeSutra - Dear Guest | |
How To Bind Mssql Table With Jtable
#2
Posted 19 October 2009 - 03:03 PM
Here is a sample code from my project... I hope it will help you.
void getTableData() { Vector<String> heading = new Vector<String>(); heading.AddElement("Code"); heading.AddElement("First Name"); heading.AddElement("Last Name"); Vector data = new Vector(); try { String table="tbl_cand_primary"; DB_Query.SelectAllQuery(table, null); while(DB_Query.Rs.Next()) { codeT = DB_Query.Rs.GetString("cand_code"); fnameT = DB_Query.Rs.GetString("fname"); lnameT = DB_Query.Rs.GetString("lname"); Vector<String> tmp = new Vector<String>(); tmp.AddElement(codeT); tmp.AddElement(fnameT); tmp.AddElement(lnameT); data.AddElement(tmp); } } catch(SQLException e) { // } finally { if (DBConnect.Conn != null) { try { DB_Query.Rs.Close(); DB_Query.S.Close (); DBConnect.Conn.Close (); } catch (Exception e) { //Ignore } } } table = new JTable(data, heading); v=ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS; h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS; jsp = new JScrollPane(table,v,h); panel_Content.SetLayout(null); jsp.SetBounds( 0, 0, 500, 150 ); panel_Content.Add( jsp ); }
-reply by Prashant Sharma
#3 Guest_Innocent Opare_*
Posted 09 December 2010 - 11:18 AM
tinoymalayil, on 20 July 2009 - 07:55 AM, said:
Please reply if anyone knows....
Reply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users














