Home > Back-end >  An insert statement in the program execution is successful, the transaction is submitted, can also p
An insert statement in the program execution is successful, the transaction is submitted, can also p

Time:09-25

Public Boolean insertScoreCount (DBWrapper db, List the List) throws SQLException {
A Boolean flag=false;
String SQL="insert into eip_dzkh_score_count t +"
"(ID, TARGET_NAME DEPT_B_NAME, DEPT_NAME, UPDATE_DATE, YEAR, MONTH, TYPE_DEPT, GOALS, FINISH, RATE, SCORE, COMPLETION_RATES, +"
"SCORE_AUTOMATIC, SCORE_FINAL, illustrateenrollment, REMARK, RESERVED_1," + "RESERVED_2 RESERVED_3, RESERVED_4, RESERVED_5, RESERVED_6," +
"RESERVED_7, RESERVED_8, RESERVED_9 RESERVED_10, RESERVED_11)" +
"Values (EIP_DZKH_SCORE_COUNT_SQE Nextval,? ,? ,? , sysdate,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? , ' '? ,? ', ');"
The prepareStatement (SQL);
for(int i=0; iSystem. The out. Println (I);
Map map=new HashMap();
The map=(map) list. The get (I);
The setString (1, (String) map. Get (" target_name "));
The setString (2, (String) map. Get (" dept_b_name "));
The setString (3, (String) map. Get (" dept_name "));
The setString (4, (String) map. Get (" year "));
Db. SetString (5, (String) map. Get (" month "));
Db. SetString (6, (String) map. Get (" type_dept "));
Db. SetString (7, (String) map. Get (" goals "));
The setString (8, (String) map. Get (" finish "));
Db. SetString (9, (String) map. Get (" rate "));
The setString (10, (String) map. Get (" score "));
Db. SetString (11, (String) map. Get (" completion_rates "));
The setString (12, (String) map. Get (" score_automatic "));
String score_final=(String) map. Get (" score_final ");
If (score_final==null | | "" equals (score_final)) {
Score_final="0.00";
}
Db. SetDouble (13, Double parseDouble (score_final));
The setString (14, (String) map. Get (" illustrateenrollment "));
The setString (15, (String) map. Get (" remark "));
Db. SetString (16, (String) map. Get (" RESERVED_1 "));
Db. SetString (17, (String) map. Get (" RESERVED_2 "));
Db. SetString (18, (String) map. Get (" RESERVED_3 "));
Db. SetString (19, (String) map. Get (" RESERVED_4 "));
The setString (20, (String) map. Get (" RESERVED_5 "));
The setString (21, (String) map. Get (" RESERVED_6 "));
The setString (22, (String) map. Get (" RESERVED_7 "));
System. The out. Println ((String) map. Get (" byxs ") + ": : : : : : : : : : : : : : : :" + (String) map. Get (" bydx "));
Db. SetString (23, (String) map. Get (" byxs "));
The setString (24, (String) map. Get (" bydx "));
Db. AddPreparedBatch ();
}
Flag=db. ExecutePreparedBatch ();
return flag;
}

CodePudding user response:

How to use double quotation marks?

CodePudding user response:

Application showmessage (SQL), and then into the SQL can see run inside

CodePudding user response:

You have a written SQL problem, debugging SQL if there are any problems,

CodePudding user response:

To solve the problem such as investigation, need to look carefully, SQL results there must be a mistake.

CodePudding user response:

Suggest a meno1 controls in the form
All those SQL back to this meno1 control
Then the meno1 controls the SQL code is copied to the run the MSSQL environment, see where the problem

Step by step test

CodePudding user response:

Can use the SQL Server Profiler tool to track the SQL statement, if you are using MS SQL Server

CodePudding user response:

Thank you all, found the reason: in the service layer calls a stored procedure, is stored procedure during execution fails, to the account transaction rollback, dao layer has no error,
Depressed,

CodePudding user response:

CodePudding user response:

Good reason to find and pick up points,

CodePudding user response:

Come pick up points, then, be bold

CodePudding user response:

refer to 7th floor u012302681 response:
thank you, cause found: in the service layer calls a stored procedure, is stored procedure during execution fails, to the account transaction rollback, dao layer has no error,
Depressed,
I also encountered the same problem specific how to solve?
  • Related