Results 1 to 2 of 2
Thread: problem in deleting data
- 10-12-2011, 08:20 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 6
- Rep Power
- 0
problem in deleting data
when i click on delete button following exception is generated
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at MyFrame.actionPerformed(AcctHld.java:226)
code of my delete button is
and when i use integer.parseint instead of typecasting into integer then i get a errorJava Code:if(o.equals(bDelete)){ try { int accountno=(Integer)mAccthld.getValueAt(tAcctHld.getSelectedRow(),0); mAccthld.removeRow(tAcctHld.getSelectedRow()); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:DRIVER=Microsoft Access DRIVER (*.mdb);DBQ=fddata.mdb"); PreparedStatement ps=con.prepareStatement("delete from accthld where AccountNo=?"); ps.setInt(1,accountno); int s=ps.executeUpdate(); System.out.println(s); con.close(); } catch(Exception ex){ ex.printStackTrace(); } }
symbol : method parseInt(java.lang.Object)
location: class java.lang.Integer
int accountno=(Integer.parseInt(mAccthld.getValueAt(tA cctHld.getSelectedRow(),0)));
^
- 10-12-2011, 09:03 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,619
- Rep Power
- 5
Similar Threads
-
Problem with deleting record.
By javaguy345 in forum JDBCReplies: 18Last Post: 05-21-2011, 02:37 AM -
String problem: deleting
By BlueBird in forum New To JavaReplies: 3Last Post: 03-18-2011, 05:21 AM -
Executing Command line commands from java - problem with deleting a file
By efebatistaarda in forum Advanced JavaReplies: 7Last Post: 02-10-2011, 07:37 PM -
deleting the data in the column model
By bigj in forum New To JavaReplies: 0Last Post: 02-08-2010, 08:15 AM -
Vector/Table Deleting Row Problem.
By ocean in forum New To JavaReplies: 8Last Post: 12-09-2009, 06:39 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks