SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: deleting row

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    India
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    deleting row

    i have used following query for delete a row in the tables.
    but its not deleting. help me

    String action = request.getParameter("action");
    if (action != null && action.equals("delete")) {
    conn.setAutoCommit(false);


    PreparedStatement pstatement = conn.prepareStatement("DELETE FROM sec_mast WHERE sec_no=?,vou_no=?");
    PreparedStatement pstatement1 = conn.prepareStatement("DELETE FROM sec_detail WHERE sec_no=?,vou_no=? ");


    pstatement.setInt(1,Integer.parseInt(request.getParameter("sec_no")));
    pstatement1.setInt(1,Integer.parseInt(request.getParameter("sec_no")));
    pstatement.setString(2,request.getParameter("vou_no"));
    pstatement1.setString(2,request.getParameter("vou_no"));

    int rowCount = pstatement.executeUpdate();
    int rowCount1 = pstatement1.executeUpdate();
    conn.setAutoCommit(false);
    conn.setAutoCommit(true);
    }


    ResultSet rs = statement.executeQuery
    ("select * from sec_mast,sec_detail where sec_mast.vou_no=sec_detail.vou_no ");


    my database table is follow:
    SQL> descr sec_mast;
    Name Null? Type
    ----------------------------------------- -------- -----------------
    SEC_NO NOT NULL NUMBER(4)
    CATG_CODE NUMBER(2)
    FACE_VAL NOT NULL NUMBER(10,2)
    PUR_VAL NOT NULL NUMBER(10,2)
    INT_PAID NOT NULL NUMBER(8,2)
    INT_RECD NOT NULL NUMBER(8,2)
    BRKR NOT NULL NUMBER(8,2)
    TOT_VAL NOT NULL NUMBER(12,2)
    VOU_NO VARCHAR2(9)
    VOU_DATE DATE
    VOU_AMT NUMBER(15,2)
    DUE_DATE1 NOT NULL DATE
    DUE_DATE2 DATE
    LF_NO NOT NULL VARCHAR2(10)
    MAT_DATE NOT NULL DATE
    FK_VOU_NO2 VARCHAR2(9)

    SQL> descr sec_detail;
    Name Null? Type
    ----------------------------------------- -------- -----------------
    SEC_NO NUMBER(4)
    LF_NO VARCHAR2(8)
    DUE_DATE1 DATE
    VOU_NO VARCHAR2(9)
    VOU_DATE DATE
    VOU_AMT NUMBER(15,2)
    FK_VOU_NO1 VARCHAR2(9)

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    your DELETE queries look fine, assuming the question marks will be properly substituted

    perhaps you should ask this question in the asp forum, assuming this language, which i don't recognize, is asp
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Guru
    Join Date
    Jan 2004
    Location
    Uppsala, sverige
    Posts
    698
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Code:
    DELETE FROM sec_mast WHERE sec_no=? and vou_no=?

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    DOH!!

    swampboogie, this is getting repetitive

    i hope there are a few other guys whom you've corrected as often

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Guru
    Join Date
    Jan 2004
    Location
    Uppsala, sverige
    Posts
    698
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)

    Smile

    Well, you have done your share of correcting my posts.


Bookmarks

Posting Permissions

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