sql - using Transaction query in jsp page -
i use below query in jsp page. i'm not sure true use query in jsp page.
int = st.executeupdate("'begin transaction declare @id [int] select @id = scope_identity() insert viewer(reserve_id, f_name, l_name, competition_id, city, phone, [e-mail]) values (@id, '" + fname + "','" + lname + "','" + 30 + "','" + city + "','" + phone + "','" + email + "' ) insert reservation_inf(reservation_date, competition_id, numberofticket, position_id) values ('" + dnow + "','" + 30 + "','" + 1 + "','" + 8 + "' ) commit transaction '" ); if (i > 0) { response.sendredirect("success.jsp"); } else { response.sendredirect("fail.jsp"); }
it gives error :
incorrect syntax near 'begin transaction declare @id [int] select @id = scope_identity() insert viewer(reserve_id, f_name, l_name, competition_id,'.
Comments
Post a Comment