Package Test.testdemo;import Org.springframework.jdbc.core.jdbctemplate;import Com.util.pub;public class Test4 { public static void Main (string[] args) {String-sql = "INSERT into temp_spring (AAC003, AAC002, D, E, F, G, H, I, J, K)" + "Values (' Tom ', ' 51253319700126xxxx ', ' Dayi County Jin North Road No. 1151th ', ' Chengdu ', ' 5 ', ' 5 ', ' 4 ', ' Dayi County People's Hospital ', ' Dayi hospital ', ' Dayi County second People's Hospital ');//used to receive re The SQL statement after place string sql2; JdbcTemplate JdbcTemplate = (jdbctemplate) pub.getbeanctx (). Getbean ("JdbcTemplate"); for (int i = 1; i < i++) {//Receive SQL statement, otherwise if Sql=sql.replace ("Tom", "Tom" +i), then the found insert is the same data SQL2 = Sql.replace ("Tom", "Tom" + i); Jdbctemplate.execute ( SQL2);}}}
Troubleshooting Java for loops and problems inserting data into the ListView in Android