Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
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:
Swing / AWT / SWT
Error when delete rows iwith multiselect
paul beppe
Ranch Hand
Posts: 86
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi
i have this error when i want delete rows in db...
i have this error:
java.lang.String cannot be cast to QueryEliminaMultiSelect
in this class i have write:
class QueryEliminaMultiSelect { int idNumDel; String dataDelString; String nomeDelString; String emailDelString; String telDelString; String fotoDelString; String notificheDelString; public QueryEliminaMultiSelect(int id1, String data1, String nome1, String email1, String tel1, String foto1, String notifiche1) { idNumDel = id1; dataDelString = data1; nomeDelString = nome1; emailDelString = email1; telDelString = tel1; fotoDelString = foto1; notificheDelString = notifiche1; } public String toString(){ return nomeDelString; } public int toInt(){ return idNumDel; } }
for delete multiselect rows i have write:
try { int[] selezione = listEdit.getSelectedIndices(); for (int i=0; i<selezione.length; i++) { conn = DriverManager.getConnection("jdbc:sqlite:db.sqlite"); QueryEliminaMultiSelect temp = (QueryEliminaMultiSelect)listEdit.getModel().getElementAt(selezione[i]); pstmt = (PreparedStatement) conn.prepareStatement("delete from dbPlanet where id="+temp.idNumDel); pstmt.executeUpdate(); modelEdit.removeElement(listEdit.getSelectedValue()); } comboShow(); pstmt.close(); conn.close(); JOptionPane.showMessageDialog(null, "Nomi Eliminati!", "Messaggio...",JOptionPane.INFORMATION_MESSAGE ); } catch (Exception exc) { exc.printStackTrace(); }
where is error???
Paul Clapham
Marshal
Posts: 28193
95
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Where is the error? The stack trace will tell you where the error is.
So look at the stack trace. It tells you the exact line of code which threw the exception. If you still have a problem, post back with complete information.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Passing array of objects......ResultSet
Sqlite error
Webservice deployment failed
Custom Class as Key for Hash Map
Unable to decrypt the encrypted message
More...