hello to every1
i have created a table 'stu' in mysql having 4 columns namely 'rno (int)' , 'name (char)', 'city (char)', 'phn (int)'
now i want to insert entries into dis table using java jdbc and with dynamic approach, so i used the commands after loading mysql driver and making appropriate connection:
{
Statement st=cn.createStatement();
int x=st.executeUpdate("insert into stu (rno,name,city,phn) values (" + args[0] + args[1] + args[2] + args[3] + ")");
System.out.println(x);
}
it is compiling successfully but at the tym of running it, i used dis command:
java Main 10 abcd wxyz 1234
where Main is the class containing void main() method and args is command line arguments, but it is showing an error:
"invalid sql column count doesn't match value count at row 1"
plz help
thanx in advance
i have created a table 'stu' in mysql having 4 columns namely 'rno (int)' , 'name (char)', 'city (char)', 'phn (int)'
now i want to insert entries into dis table using java jdbc and with dynamic approach, so i used the commands after loading mysql driver and making appropriate connection:
{
Statement st=cn.createStatement();
int x=st.executeUpdate("insert into stu (rno,name,city,phn) values (" + args[0] + args[1] + args[2] + args[3] + ")");
System.out.println(x);
}
it is compiling successfully but at the tym of running it, i used dis command:
java Main 10 abcd wxyz 1234
where Main is the class containing void main() method and args is command line arguments, but it is showing an error:
"invalid sql column count doesn't match value count at row 1"
plz help
thanx in advance