Expert:Tariq Mehmood
Hi I am trying to put my data into database. But I found the error of :
java.sql.SQLException: Column count doesn't match value count at row 1 I checked the No. of column in table and values in row are same. I don't know whats the problem. Complete code is given below.
please help me Thanks
public void insertQuery(String name , String gender, String d_O_Birth , String nationality, String m_Status, String address, String qualification, String profession , String profession_History ){ con = getDBConnection(); try{ PreparedStatement pstmt = con.prepareStatement("insert into volunteer_profiles(name, gender, d_o_birth, nationality, marital_status, address, qualification, profession , profession_history ) values (?????????)"); pstmt.setString(1, name); pstmt.addBatch(); pstmt.setString(2, gender); pstmt.addBatch(); pstmt.setString(3, d_O_Birth); pstmt.addBatch(); pstmt.setString(4, nationality); pstmt.addBatch(); pstmt.setString(5, m_Status); pstmt.addBatch(); pstmt.setString(6, address); pstmt.addBatch(); pstmt.setString(7, qualification); pstmt.addBatch(); pstmt.setString(8, profession); pstmt.addBatch(); pstmt.setString(9, profession_History); pstmt.addBatch(); System.out.println("parameter are like =>>>>>" +"1"+name +"2"+ gender +"3"+ d_O_Birth +"4"+ nationality+"5"+m_Status+"6"+address +"7"+qualification +"8"+ profession +"9"+ profession_History); pstmt.execute(); //System.out.println("Hello It is the clue"+rs); }catch (Exception ex){ System.out.println ("Exception catch in makeQuery method() "+ ex); } }
|