Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
iphone x used
AssassiN1
Updated:
Sunday at 10:30 PM
කිතුල් තලප
Manoj Suranga Bandara
Updated:
Saturday at 7:04 PM
Ad icon
ව්යාපාර, Tuition පන්ති සහ Personal Portfolios සඳහා Web Setup එකක් රු. 9,099/- කට (වාර්ෂික renewal ර
thathsilura
Updated:
Thursday at 6:17 PM
AWS Certified Solutions Architect-Associate + AWS Certified Cloud Practitioner
Sanjeewani95
Updated:
Aug 19, 2026
🚀 එක පැකේජ් එකයි - මාසෙටම Unlimited Internet! 🌐
sayuru bandara
Updated:
Aug 18, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
ElaKiri Programmer's Club
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Voltage" data-source="post: 17890772" data-attributes="member: 391265"><p><span style="color: Black"></span></p><p><span style="color: Black"></span></p><p><span style="color: Black"></span></p><p></p><p></p><p><span style="font-size: 15px"><span style="color: Red"></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong>වැඩේ ගොඩ දාගත්ත මචන්. යන්තන් query එක ලියාගත්තා. දුකේ බෑ බන් වැඩ කරනවා ලෙසටම.</strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><strong><span style="color: Green">MihiCherub thanks මචන් අතන මම table එකට වැඩිපුර field එකක් දාල මචන්. මට ඔයා කිවුවම තමයි මීටර් උනේ. ඒ table එකේ තියන අන්තිම field එකක මම FK කරල දාලා තිබුනෙ. දැන් වැඩේ හරි</span></strong></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong>Query එක මීට වඩා අඩුවෙන් ලියන්න පුලුවන් ක්රමයක් තියෙනවද. මේ query එකෙන් නම් ඕන කරන result එක එනවා</strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px">[CODE] int row = JtableCat.getSelectedRow();</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> String selectedCat = JtableCat.getModel().getValueAt(row,0).toString(); </span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> </span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> //CatName to CatID Query</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> ResultSet rsCatNameToId = db.getData(("SELECT cat_id FROM itemcategory WHERE cat_name='"+selectedCat+"'"));</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> while (rsCatNameToId.next()) { </span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> int theCatId = rsCatNameToId.getInt("cat_id");</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> //Main Search Query</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> ResultSet rsCat = db.getData("SELECT * FROM items WHERE itemCategory_cat_id='"+theCatId+"'"); </span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> DefaultTableModel dtmItems = (DefaultTableModel) JtitemTable.getModel();</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> dtmItems.setRowCount(0);</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> while (rsCat.next()){</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> Vector vItem = new Vector();</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> vItem.add(rsCat.getString("item_name"));</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> vItem.add(rsCat.getString("item_qty"));</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> dtmItems.addRow(vItem);</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> }</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> </span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> </span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong><span style="font-size: 9px"> }[/CODE]</span></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong></strong></span></span></p><p><span style="font-size: 15px"><span style="color: Red"><strong></strong></span></span></p></blockquote><p></p>
[QUOTE="Voltage, post: 17890772, member: 391265"] [COLOR="Black"] [/COLOR] [SIZE="4"][COLOR="Red"] [B]වැඩේ ගොඩ දාගත්ත මචන්. යන්තන් query එක ලියාගත්තා. දුකේ බෑ බන් වැඩ කරනවා ලෙසටම. [B][COLOR="Green"]MihiCherub thanks මචන් අතන මම table එකට වැඩිපුර field එකක් දාල මචන්. මට ඔයා කිවුවම තමයි මීටර් උනේ. ඒ table එකේ තියන අන්තිම field එකක මම FK කරල දාලා තිබුනෙ. දැන් වැඩේ හරි[/COLOR][/B] Query එක මීට වඩා අඩුවෙන් ලියන්න පුලුවන් ක්රමයක් තියෙනවද. මේ query එකෙන් නම් ඕන කරන result එක එනවා [SIZE="1"][CODE] int row = JtableCat.getSelectedRow(); String selectedCat = JtableCat.getModel().getValueAt(row,0).toString(); //CatName to CatID Query ResultSet rsCatNameToId = db.getData(("SELECT cat_id FROM itemcategory WHERE cat_name='"+selectedCat+"'")); while (rsCatNameToId.next()) { int theCatId = rsCatNameToId.getInt("cat_id"); //Main Search Query ResultSet rsCat = db.getData("SELECT * FROM items WHERE itemCategory_cat_id='"+theCatId+"'"); DefaultTableModel dtmItems = (DefaultTableModel) JtitemTable.getModel(); dtmItems.setRowCount(0); while (rsCat.next()){ Vector vItem = new Vector(); vItem.add(rsCat.getString("item_name")); vItem.add(rsCat.getString("item_qty")); dtmItems.addRow(vItem); } }[/CODE][/SIZE] [/B][/COLOR][/SIZE] [/QUOTE]
Insert quotes…
Verification
Haya warak paha keeyada? (haya wadi kireema paha)
Post reply
Top
Bottom