Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners RetDAO.java (part1) ..reference. Is this logic good?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


prateek agarwal
RetDAO.java (part1) ..reference. Is this logic good?
0 Answer(s)      2 years and 7 months ago
Posted in : Java Beginners


public static int searchDelete(Connection conn,String ret_id) throws Exception {
//System.out.println(ret_id); st=conn.createStatement(); //System.out.println("Where"); ResultSet rs=st.executeQuery("select * from RETAILER where RETAILERID='"+retid+"'"); //System.out.println("asudhwdioq");

    if(rs.next())
    {
        return 1;
    }
    else return 0;
}

public static int chk_order(Connection conn,String ret_id) throws Exception
{
    int a=0;
    System.out.println("Where");
    System.out.println(ret_id);
    ResultSet rs=st.executeQuery("select * from ORDER_TABLE where RETAILER_ID='"+ret_id+"'");

    System.out.println("qwggggg");

    if(rs.next()==false)
    {
        return 2;
    }
    while(rs.next())
    {   
        System.out.println("qwggggg");
        if(rs.getString(4).equals("Allocated"))
        {
            System.out.println("Girish");
            a=0;
            break;
        }
        else a=1;
        System.out.println(rs.getString(4));
    }
    if(a==0)
    {
        return 0;     
    }
    else return 1;
}

public static int untag(Connection conn,String ret_id) throws Exception
{
    st=conn.createStatement();
    System.out.println("Delete ho ja");
    int k=st.executeUpdate("delete from tag_product_tbl where retailer_id='"+ret_id+"'");
    return k;
}


public static int deleteRet(Connection conn,String ret_id) throws Exception
{
    st=conn.createStatement(); 
    System.out.println("Delete yahape bhi hoga");

    rs=st.executeQuery("select * from retailer where retailer_id='"+ret_id+"'");
    rs.next();
    String s1=rs.getString(1);
    String s2=rs.getString(2);
    String s3=rs.getString(3);
    String s4=rs.getString(4);
    int s5=rs.getInt(5);
    String s6=rs.getString(6);
    String s7=rs.getString(8);
    String s8=rs.getString(9);

    System.out.println(s1);
    System.out.println(s2);
    System.out.println(s3);
    System.out.println(s4);
    System.out.println(s5);
    System.out.println(s6);
    System.out.println(s7);
    System.out.println(s8);

    int a=st.executeUpdate("insert into inactive values('"+s1+"','"+s2+"','"+s3+"','"+s4+"',"+s5+",'"+s6+"')");
    System.out.println("a="+a);

    int z=st.executeUpdate("delete from retailer where retailer_id='"+ret_id+"'");
    System.out.println("hua kya?");
    return z;
}

Advertisement
View Answers

Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com