private void eaddbtnActionPerformed(java.awt.event.ActionEvent evt) {
if(eaddbtn.getText().equals("Add")){
eaddbtn.setText("Save");
eupbtn.setVisible(false);
// edeletebtn.setVisible(false);
ecanbtn.setText("Cancel");
}
else{
Enrollment e = new Enrollment(eid_txt.getText(),ecode_txt.getText(),egrade_txt.getText() , emarks_txt.getText() ); // ERROR APPEARS IN HERE
e.SaveEnrollment();
}
}
i want to add int value to mysql database...how can i do that?
how to convert int value to string value...
here is my enrollment class...
public class Enrollment {
private String student_id;
private String subject_code;
private String Grade;
private int Marks;
Enrollment(String student_id,String subject_code,String Grade, int Marks){
this.student_id = student_id;
this.subject_code = subject_code;
this.Grade = Grade;
this.Marks = Marks;
}
public String getGrade() {
return Grade;
}
public void setGrade(String Grade) {
this.Grade = Grade;
}
public int getMarks() {
return Marks;
}
public void setMarks(int Marks) {
this.Marks = Marks;
}
public String getStudent_id() {
return student_id;
}
public void setStudent_id(String student_id) {
this.student_id = student_id;
}
public String getSubject_code() {
return subject_code;
}
public void setSubject_code(String subject_code) {
this.subject_code = subject_code;
}
public boolean SaveEnrollment()
{
try{
DatabaseCon.update("INSERT INTO enrollrd(student_id, subject_code,marks, grade) VALUES('" + student_id +"','"+ subject_code +"' ,'" + Marks + "' ,'"+Grade + "')");
return true;
}
catch (Exception e) {
e.printStackTrace();
return false;
}
}
}
i'm lost in here..pls help me...
thanks in advance!