I am new to programming and am trying to create a program to access a database of DVD's. I want to input a unique code for a title and display relevant fields from that record.
I am getting the error above and have spent many hours now trying to see where I am going wrong.
The code:
import javax.swing.*;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
public class TEST1
{
public static void main( String args[] )
{
String inputDVDcode;
String indata;
getdetails calldvd;
indata=JOptionPane.showInputDialog("Enter a DVD Code or (-1 to quit): "); //call dialogue box requesting dvd code
inputDVDcode = (indata); //assign dvd code to inputDVDcode variable;
getdetails();
// System.out.println(inputDVDcode); //test if input works
}
public static void getdetails(String args[]) //gets dvd details and displays in JoptionPane
{
Connection connection;
Statement st;
String out="";
JTextArea display=new JTextArea();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection= DriverManager.getConnection("jdbc:odbc:MYDVDS","","");
st = connection.createStatement();
ResultSet rec = st.executeQuery( "SELECT Cost, Title, Genre, Category FROM finaldetails where Code = 'inputDVDcode' ");
while (rec.next())
{
out="DVD : " + rec.getString("Title")+"\t"+ rec.getString("Genre")+"\t"+ rec.getString("Category") + "\t"+ rec.getString("Cost");
display.setText(out);
JOptionPane.showMessageDialog(null,display);
}
}
catch (Exception e)
{
e.printStackTrace();
System.exit(0);
}
}
}
I get the error:
getdetails(java.lang.String[]) in TEST1 cannot be applied to ()
Can anyone please at least point me in the right direction?
Cheers