error sysntax mariadb any can help me?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

error sysntax mariadb any can help me?

Postby JRFabianMateo » 28. February 2016 16:50

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);
}


}}
JRFabianMateo
 
Posts: 1
Joined: 28. February 2016 16:38
Operating System: Windows 8

Re: error sysntax mariadb any can help me?

Postby Nobbie » 28. February 2016 22:36

JRFabianMateo wrote: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


As you can see, you somehow do not pass the correct strings to the executeQuery(). Instead of "+str+" and "+str2" you should concatenate the corresponding string values, but for any reason it is not concatenated, neither are the values inserted. I dont know this language, therefore i cannot tell you what is wrong about that syntax, but that must be wrong and you have to replace it by the correct syntax.

It is NOT a question of MariaDB, it is a question of this concatenation (JavaScript?!).
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 158 guests