sql - how to avoid updation of id column -


i don't want update id column because auto incremented . when run code face

java.sql.sqlexception: no value specified parameter 1.

so question how avoid / bypass update.

 string sql="";                   sql = "insert registration(first_name,last_name,gender,email_id,dob,"                  + "father_name,mother_name,contact,mobile,address,city,country,graduation,"                  + "graduation_marks,graduation_year,inter,inter_marks,inter_year,high_school,"                  + "high_marks,high_year,role,salary,resume,photo,pre_comp) value(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";                     //   int i=0;                                 preparedstatement p = con.preparestatement(sql);                           p.setstring(2,registration.first_name);                         p.setstring(3,registration.last_name);                         p.setstring(4,registration.gender);                         p.setstring(5,registration.email_id);  

as specified in error message: "no value specified parameter 1"

the problem here "first_name" first column in insert query expect value.

but preparedstatement sets parameter values starting index 2. should done starting index 1

that is, p.setstring(1, registration.first_name)


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -