私は更新クエリのMySQLストアドプロシージャを作成しました。その後どのように私はMySqlにパラメータ値を渡すことができますストアドプロシージャ
delimiter //
create procedure studentrcs(sname varchar(20),smark1 int(3),smark2 int(3),stotal int(10),inout Regno int(6))
begin
UPDATE studentrecords set student_name=sname,mark1=smark1,mark2=smark2,total=stotal where Reg_no=Regno;
end;//
、コール可能文を通じて、私は(実行時)の値を渡すことができますどのようにパラメータ
CallableStatement calstat=null;
calstat=conn.prepareCall("{call studentrcs(?,?,?,?,?)}"); // **how i can pass the value here(at run time).**
//System.out.println("Update");
calstat.setString(1,tname.getText());
calstat.setString(2, treg.getText());
calstat.setString(3, tmark1.getText());
calstat.setString(4, tmark2.getText());
calstat.setString(5, ttotal.getText());
calstat.executeUpdate();
なぜあなたは正しい答えを与えていないのですか? – YumYumYum