you have error in SQL Syntax;check the manual that correspond to your MariaDB server version for the right systax to use near First Name = '"+str+"' && Last Name = '"+str2+"' && Subject = '"+str3+"' at line 1
if(ae.getSource()== btn_find)
{
try
{
dbOpen();
String str = JOptionPane.showInputDialog(null, "Enter First Name : ","Message",JOptionPane.QUESTION_MESSAGE);
String str2 = JOptionPane.showInputDialog(null, "Enter Last Name : ","Message", JOptionPane.QUESTION_MESSAGE);
String str3 = JOptionPane.showInputDialog(null, "Enter Subject : ","Message", JOptionPane.QUESTION_MESSAGE);
rs=st.executeQuery("SELECT * FROM gradeinfo WHERE First Name = '"+str+"' && Last Name = '"+str2+"' && Subject = '"+str3+"' ");
rs.next();
setText();
btn_find.setEnabled(false);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,e.getMessage(),"Message",JOptionPane.ERROR_MESSAGE);
}
}}