例外:参数索引超出范围(0 <1)

时间:2017-02-01 10:49:01

标签: jsp

我正在尝试执行此查询,但我仍然有这个异常告诉我:参数索引超出范围(0 <1),我不知道为什么会出现此异常。

String insert_doctor = "INSERT INTO doctor_info (user_id, fname, mname, lname, gender, DOB, reg_id, reg_date, contact, clinic_name, clinic_addr, city, state, country, clinic_phone,qualification,specialization,interests) VALUES (? ,? ,? ,? ,? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)";
PreparedStatement insert_data = conn.prepareStatement(insert_doctor);                   
                            String userid= Integer.toString(user_id);
                            insert_data.setString(1, userid);
                            insert_data.setString(2, fname);
                            insert_data.setString(3, mname);
                            insert_data.setString(4, lname);
                            insert_data.setString(5, gender);
                            insert_data.setString(6, dob);
                            insert_data.setString(7, reg_id);
                            insert_data.setString(8,reg_date);
                            insert_data.setString(9, contact);
                            insert_data.setString(10, clinic_name);
                            insert_data.setString(11, clinic_addr);
                            insert_data.setString(12, city);
                            insert_data.setString(13, state);
                            insert_data.setString(14, country);
                            insert_data.setString(15, clinic_phone);
                            insert_data.setString(16, qualification_s);
                            insert_data.setString(17, specialization_s);
                            insert_data.setString(18, interest_s);

0 个答案:

没有答案