dear friends,
i am able to get a bunch of datas from select box , but while inserting into database , only one data had been getting inserted, how to insert all the datas...
i will show the code, please give ur valuable suggestions

<% 

 String s1=(String)session.getAttribute("eid");


    String s3[]=request.getParameterValues("language");
    int  i=0;
 //int j=0;


try {

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con=DriverManager.getConnection("jdbc:odbc:langskill");

PreparedStatement pStmt = con.prepareStatement("update lang set language=? where eid=" + s1+"");

for ( i = 0; i < s3.length; i++)
{

        pStmt.setString(1, s3[i]);

        pStmt.executeUpdate();
         out.println(s3[i]);

  }
     }
     catch(Exception e)
                         {
                        System.out.println(e);
                            }


 %>

             <% 

    if(i>0)
    {

    %>
     <%=(String)session.getAttribute("ename")%>
  datas are updated

  <%


     }
    else
        {

        %>
       <%=(String)session.getAttribute("ename")%>
        datas are not updated

        <%

        }

        %>

don't do that using JSP.

Jwenting is right, put that code in a servlet. And not to mention if "eid" is the primary key of your "lang" table, you end up overwriting values.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.