Home > database >  mysql
mysql

Time:10-10

 public int insertSc Sc (Sc) {
String SQL="insert into sc (sno, cno, tno, ps, ks, zp) values (?,?,?,?,? ,? ,? ,? ,? ,?) ";
The Object obj=new Object [] {
Sc. GetSno (),
Sc. GetCno (),
Sc. GetTno (),
Sc. GetPs (),
Sc. GetKs (),
Sc. GetZp ()
};
Return this. The jdbcTemplate. Update (SQL, obj);
}

Insert data in the table to the sc, sno, cno joint primary key, is also two foreign keys, I confirm with the other two tables I insert the primary key of the information, insert in the command line is successful, but was inserted into a jdbcTemplate
Under Caused by: Java. SQL. SQLException: No value specified for the parameter 2
The update also can appear the same mistake, could you tell me how to solve?

CodePudding user response:

You directly write each value object in the array to see if I can make it successful,

CodePudding user response:

Has been tried, or to the original error

CodePudding user response:

reference 1/f, gypsy song response:
you directly write each value object in the array to see if I can make it successful.

Has been tried, or to the original error

CodePudding user response:

Remove the main foreign key try,

CodePudding user response:

Erro: no two specified values for the parameters, cno have value?