java - Update Jtable values to MySql table -


i want update mysql using jtable data. have 6 columns(periods,mon,tue,wed,thu,fri) in mysql. in jtable have same table in mysql. in mysql have given periods values(1,2,3,4).

connection con = driver.connect();  (int = 0; < 4; i++) {    for(int j=1;j<=4;j++){      handler.setdata(con, "update sem1 set mon='"+jtable1.getvalueat(i, 1)+"'      periods='"+j+"'" );      handler.setdata(con, "update sem1 set tue='"+jtable1.getvalueat(i, 2)+"'      periods='"+j+"'" );      handler.setdata(con, "update sem1 set wed='"+jtable1.getvalueat(i, 3)+"'      periods='"+j+"'" );      handler.setdata(con, "update sem1 set thu='"+jtable1.getvalueat(i, 4)+"'      periods='"+j+"'" );      handler.setdata(con, "update sem1 set fri='"+jtable1.getvalueat(i, 5)+"'      periods='"+j+"'" );      }    } 

this jtable

this mysql table.it should same jtable

  • please read oracle tutorial jtable,

  • table in databases has similair structure jtable in swing,

  • (no idea code before) each of loops inside resultset returns 1 row, same order defined in sql query,

  • create array fills data database row , add arraya new row xxxtablemodel

  • search resultsettablemodel or tablefromdatabase


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -