Help me please -- Very Urgent

db , java India
  • 13 years ago

    Hi,
    Iam new to Java. I want to insert multiple values to database from two multiple select box in jsp page. Followong is my code. By this i can insert single value only....
            
    String[] s14 = request.getParameterValues("prodName");
    String[] s15 = request.getParameterValues("natureName");
    String s16 = request.getParameter("compId");

    PreparedStatement prStmt = con.prepareStatement("Insert into comp_prod (comp_id, pro_id, nat_id) values (?,?,?)");
     prStmt.setString(1, s16);

    for (int i = 0; i < s14.length; i++)
            {
            prStmt.setString(2, s14[i]);
            }

    for (i = 0; i < s15.length; i++)
            {
            prStmt.setString(3, s15[i]);
            }
    prStmt.executeUpdate();   

    Anyu one please help me. Its very urgent for me..
     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Owning a computer without programming is like having a kitchen and using only the microwave oven” - Charles Petzold