Results 1 to 2 of 2
  1. #1
    adeeb is offline Member
    Join Date
    May 2008
    Posts
    29
    Rep Power
    0

    Default Regarding Data Insertion

    Hi,
    I have written the code for application and it compiles and i get the output also without any errors.But when i type text and click add button the values are not being inserted. Some one please help me.

    add.addActionListener(new ActionListener()
    {

    public void actionPerformed(ActionEvent ae)
    {
    if(ae.getActionCommand()=="Add")
    {
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection("jdbc.odbc.addissue"," library","bismillah");
    PreparedStatement ps = conn.prepareStatement("INSERT INTO addissue VALUES(?,?,?,?)");

    String str0 = addtf.getText();
    String str1 = addtf1.getText();
    String str2 = addtf2.getText();
    String str3 = addtf3.getText();
    ps.setInt(1,Integer.parseInt(str0));
    ps.setString(2,str1);
    ps.setString(3,str2);
    ps.setString(4,str3);
    ps.executeUpdate();
    conn.close();
    }
    catch(Exception ce)
    {
    }
    }
    }
    });

  2. #2
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    10

    Default

    how about putting some printStackTrace() in your exception handlers. Throwing away the exceptions tends to make debugging a lot harder than it needs to be

Similar Threads

  1. image insertion into database
    By abhiN in forum JDBC
    Replies: 4
    Last Post: 01-05-2009, 06:09 AM
  2. Insertion Sort in Java
    By Java Tip in forum Algorithms
    Replies: 0
    Last Post: 04-15-2008, 08:41 PM
  3. Using PreparedStatement for insertion
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-06-2008, 10:30 AM
  4. database insertion
    By abhiN in forum New To Java
    Replies: 0
    Last Post: 01-17-2008, 08:24 AM
  5. Insertion sort algorithm
    By Albert in forum Advanced Java
    Replies: 2
    Last Post: 06-28-2007, 09:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •