Results 1 to 2 of 2
  1. #1
    dazey is offline Member
    Join Date
    Apr 2013
    Posts
    3
    Rep Power
    0

    Default ResultSet Function deleteRow() : PLEASE HELP!!

    Following is a code i am working on :-
    Java Code:
    import java.sql.*;
    
    
    public class deleteRowDemo 
    {
        public static void main(String args[])
        {
        Connection con;
        Statement stmt;
        ResultSet rs;
        PreparedStatement ps;
        
         try
           {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          con=DriverManager.getConnection("jdbc:odbc:Project");
          stmt=con.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE);
          rs=stmt.executeQuery("select Mword, from Model,Stud where Mword=Sword");
          
           while(rs.next())
           { 
           ps=con.prepareStatement("insert into Compare (Cword) values (?)");
           ps.setString(1,rs.getString(1));
           ps.executeUpdate();   
           rs.deleteRow();
           }
          con.close();
        }
    catch(Exception e)
    {
        System.out.println(e);
        
    }}
    }
    There are two tables Model and Stud. The two tables are beng compared and all the words that are similar in both the tables are inserted in another table called Compare, at the same time i wish to delete the words from both the Stud and Model tables. The function deleteRow() works fine when the select statement has only one table , but how to work it out for complex select statements for multiple tables.
    PLEASE HELP!!
    Last edited by dazey; 05-05-2013 at 11:57 AM.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default Re: ResultSet Function deleteRow() : PLEASE HELP!!

    Please don't double post; I'm closing this thread and answered your question in your other thread (in the 'new to java' forums).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Recursive function to iteractive function
    By mikeZet in forum New To Java
    Replies: 0
    Last Post: 03-13-2012, 01:42 AM
  2. Calling function in Javascript- from other function
    By jdigger in forum New To Java
    Replies: 1
    Last Post: 02-27-2011, 09:00 PM
  3. Replies: 3
    Last Post: 12-04-2009, 03:08 PM
  4. Help with Resultset
    By xxAlemanxx in forum JDBC
    Replies: 6
    Last Post: 06-24-2008, 11:09 AM
  5. ResultSet example
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-20-2008, 08:59 AM

Posting Permissions

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