Hello, frnz...
my application is a jdbc program which has the code as follows...
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class test extends JApplet implements ActionListener,ItemListener
{
JLabel l1,l2;
JTextField t1;
JButton save;
JPanel p1,p2;
Container cp=getContentPane();
JCheckBox cb[];
String sel=" ";
public void init()
{
cp.setLayout(new FlowLayout());
t1=new JTextField(10);
l1=new JLabel("enter name");
p1=new JPanel();
p1.add(l1);
p1.add(t1);
p2=new JPanel();
l2=new JLabel("Select your Occupation");
p2.add(l2);
cb=new JCheckBox[3];
for(int i=1;i<4;i )
{
c=new JCheckBox();
p2.add(c);
c.addItemListener(this);
}
cb[0].setText("ONE");
cb[1].setText("TWO");
cb[2].setText("THREE");
save=new JButton("SAVE");
p2.add(save);
save.addActionListener(this);
cp.add(p1);
cp.add(p2);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==save)
{
String name=t1.getText();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
System.out.println("Class Exception occured");
}
try
{
Connection con=DriverManager.getConnection("jdbcdbc:mvgr","system","management");
Statement s=con.createStatement();
String query="Insert into abc values(name " " sel )";---error
int c=s.executeUpdate(query);
System.out.println(c "rows inserted");
}
catch(SQLException e)
{
System.out.println("Exception occured");
}
}
public void itemStateChanged(ItemEvent i)-- error
{
//if(i.getStateChange()==ItemEvent.SELECTED)
sel=sel ((JCheckBox)(i.getItemSelectable())).getText();
}
}
}
when i compiled the program.....
iam getting 1 error at "query initialization" and 4 errors at the method "itemstatechanged()"....
here the thing which let us to confusion state is the error--- " ; expected " at the end of above statements
i found no solution for this...
iam xpctng ur response regerding my program....plz help me....
my application is a jdbc program which has the code as follows...
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class test extends JApplet implements ActionListener,ItemListener
{
JLabel l1,l2;
JTextField t1;
JButton save;
JPanel p1,p2;
Container cp=getContentPane();
JCheckBox cb[];
String sel=" ";
public void init()
{
cp.setLayout(new FlowLayout());
t1=new JTextField(10);
l1=new JLabel("enter name");
p1=new JPanel();
p1.add(l1);
p1.add(t1);
p2=new JPanel();
l2=new JLabel("Select your Occupation");
p2.add(l2);
cb=new JCheckBox[3];
for(int i=1;i<4;i )
{
c=new JCheckBox();
p2.add(c);
c.addItemListener(this);
}
cb[0].setText("ONE");
cb[1].setText("TWO");
cb[2].setText("THREE");
save=new JButton("SAVE");
p2.add(save);
save.addActionListener(this);
cp.add(p1);
cp.add(p2);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==save)
{
String name=t1.getText();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
System.out.println("Class Exception occured");
}
try
{
Connection con=DriverManager.getConnection("jdbcdbc:mvgr","system","management");
Statement s=con.createStatement();
String query="Insert into abc values(name " " sel )";---error
int c=s.executeUpdate(query);
System.out.println(c "rows inserted");
}
catch(SQLException e)
{
System.out.println("Exception occured");
}
}
public void itemStateChanged(ItemEvent i)-- error
{
//if(i.getStateChange()==ItemEvent.SELECTED)
sel=sel ((JCheckBox)(i.getItemSelectable())).getText();
}
}
}
when i compiled the program.....
iam getting 1 error at "query initialization" and 4 errors at the method "itemstatechanged()"....
here the thing which let us to confusion state is the error--- " ; expected " at the end of above statements
i found no solution for this...
iam xpctng ur response regerding my program....plz help me....