This error is triggerred whether the bpressed objects is an Integer or a string
I have defined the seatno as a number type in ms access and status as a text type in ms access
I hav tried
bpressed=Integer.parseInt(ae.getActionCommand())
But it does not make any difference to the outcome
Thanks quuba and jamescherril for helping solve my previous problem
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
public class Screen1 implements ActionListener , WindowListener
{
int i;
JFrame scrfrm1;
JLabel lblscr;
JButton seats[] = new JButton[100];
int left,top;
Screen1()
{
scrfrm1 = new JFrame("Screen1");
for(i=0;i<100;i++)
{
seats[i] = new JButton(String.valueOf(i + 1));
seats[i].putClientProperty("index", new Integer(i));
}
//line one of buttons
//seat1.setBounds
for(int i=0;i<100;i++)
seats[i].addActionListener(this);
scrfrm1.addWindowListener(this);
scrfrm1.setLayout(null);
scrfrm1.setBounds(100,0,1200,740);
scrfrm1.setVisible(true);
scrfrm1.setResizable(true);
}
public void actionPerformed(ActionEvent ae)
{
String bpressed="";
for(i=0;i<100;i++)
if(ae.getSource()==seats[i])
{
try
{
bpressed = ae.getActionCommand();
System.out.println(bpressed);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection connect = DriverManager.getConnection("jdbc:odbc:Multiplex","Pradeep","theatre");
Statement bookseat = connect.createStatement();
bookseat.execute("update Screen1 set status = 'no' where seatno = '"+bpressed+"'");//error line
}catch(Exception e){e.printStackTrace();}
}
}
public void windowOpened(WindowEvent we){}
public void windowClosed(WindowEvent we){}
public void windowClosing(WindowEvent we)
{
/*String ObjButtons[] = {"Yes","No"};
int PromptResult = JOptionPane.showOptionDialog(null,"Are you sure you want to exit?","Multiplex Theatre Central",JOptionPane.DEFAULT_OPTION,JOptionPane.WARNING_MESSAGE,null,ObjButtons,ObjButtons[1]);*/
//if(PromptResult==0)
//{
System.exit(0);
//}
//else
//{
//MainPage mp=new MainPage();
//}
}
public void windowIconified(WindowEvent w){}
public void windowDeiconified(WindowEvent w){}
public void windowActivated(WindowEvent w){}
public void windowDeactivated(WindowEvent w){}
public static void main(String args[])
{
Screen1 scr1 = new Screen1();
}
}