Help me regarding this topic
Hi, to all i am new to core java and question on Swings. See this code
and help me.
I want to calculate student marks and his average. When i click button
total marks will have calculate and i am posting code below
Thanks
if(ae.getSource()==btnCal)
{
btnNew.setEnabled(true);
btnSave.setEnabled(false);
btnDel.setEnabled(true);
Connection conSno;
Statement stSno;
int Total,Average;
int English = Integer.praseInt(tfEng.getText());
int Telugu = Integer.praseInt(tfTel.getText());
int Mathmatics = Integer.praseInt(tfMaths.getText());
int Science = Integer.praseInt(tfSci.getText());
int Social = Integer.praseInt(tfSoc.getText());
int Hindi = Integer.praseInt(tfHin.getText());
Class.forName("sun.Jdbc.Odbc.JdbcOdbcDriver");
conSno =
DriverManager.getConnection("jdbc:odbc:DRIVER{Microsoft Access
Driver(*.mdb)};DBQ=D:\\ProgressReport.mdb");
Total = English+Telugu+Mathmatics+Science+Social+Hindi;
Average = Total / 6;
tfTot.setText(String.ValueOf(Total));
tfAvg.setText(String.ValueOf(Average));
stSno=conSno.createStatement();
ResultSet rsSno=stSno.executeQuery("select Tot,Avg from
ProgressReport where Sno = '"+Sno+"'");
if(rsSno.next())
{
tfTot.setText(rsSno.getString(12));
tfAvg.setText(rsSno.getString(13));
} // end of the if condition
} // end of the btnCal