TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Arbaaz Shaikh
NA
8
593
I get NullPointerException on adding details.
Dec 25 2018 8:44 AM
private void addActionPerformed(java.awt.event.ActionEvent evt) {
String name = name1.getText();
String mmath = math.getText();
String sci = science.getText();
String english = eng.getText();
int tot = Integer.parseInt(mmath)+Integer.parseInt(sci)+Integer.parseInt(english);
double percent1 = tot/3;
String ins = "insert into tbname(name,maths,science,english,total,percent)values('"+name+"','"+mmath+"','"+sci+"','"+english+"','"+tot+"','"+percent1+"')";
try{
Statement st = con.createStatement();
int i=0;
i = st.executeUpdate(ins);
if(i!=0)
{
JOptionPane.showMessageDialog(rootPane, "Data Added :)");
}
else
{
JOptionPane.showMessageDialog(rootPane, "Data Not Added :(");
}
}
catch(Exception ex)
{
System.out.print(ex);
}
}
Reply
Answers (
2
)
Java language for selenium
Java Web Start in Asp.net