Results 1 to 3 of 3
  1. #1
    satyaram is offline Member
    Join Date
    Jan 2009
    Posts
    4
    Rep Power
    0

    Question I have a problem with autoincremented column with jsp select tag

    System.out.println("in jsp tag");
    DataCon dc=new DataCon();
    System.out.println(dc);
    Connection con=null;
    Statement st=null;
    ResultSet rs=null;
    try{
    con=dc.getConnection1();
    System.out.println(con);
    st=con.createStatement();
    System.out.println(st);
    rs=st.executeQuery("select max(CUST_NO) from CUSTOMER_MASTER");
    System.out.println(rs);
    while(rs.next())
    {
    id=rs.getInt(1);
    //System.out.println(id);
    id=id+1;
    }
    System.out.println("id"+id);
    %>
    <option value="<%=id%>"><%=id%></option>
    <%
    con.close();
    }
    catch(Exception e)

    above code is respect to the select tag in registration form

    select tag is respected auto incremented column,auto incremented value is not adding to the combo box.......please help me...........

  2. #2
    satyaram is offline Member
    Join Date
    Jan 2009
    Posts
    4
    Rep Power
    0

    Default

    solve my prob please

  3. #3
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    You got an exception there, that is why it is not incremented.Add try and catch statements when you extract data from database, then when finished close the database connection.

Similar Threads

  1. insert row and column and delete row and column
    By daredavil82 in forum New To Java
    Replies: 13
    Last Post: 09-22-2011, 06:10 PM
  2. How to retain value in struts 2 using <s:select></s:select> tag
    By SaiPrasad@Sella in forum Web Frameworks
    Replies: 0
    Last Post: 02-09-2009, 07:23 AM
  3. problem in select query
    By herfnai in forum JDBC
    Replies: 0
    Last Post: 08-17-2008, 11:47 AM
  4. Excel Column
    By Gajesh Tripathi in forum New To Java
    Replies: 2
    Last Post: 04-13-2008, 02:26 PM
  5. JDBC select problem
    By abhiN in forum JDBC
    Replies: 0
    Last Post: 03-12-2008, 08:09 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
  •