I have a project on sports Club Management. In that, I am providing add, delete, update and search facility.
Add command is working simply by : String qry="Insert into sport values('"+s1+"')"
;smt.executeUpdate(qry);
This is just an example where I took only s1.
But in delete, I wrote:
String qry="Delete from sport where Mid=' "+smid+" '";
rs=smt.executeQuery(qry);
rs.next();
/* Here mid is Member id. According to the query statement, all the values i.e. the entire row which has smid as Mid should get deleted. But this doesn't happen. At first it showed a SQLException Too few parameters. After making a bit changes it showed No resultset.
Can you pls. correct me.
One more thing I am in the constructor portion, taking smt=con.createStatement();
*/
//When I tried the search part, I provided the query:
String qry="Select * from sport where Mid='"+smid+"';
rs=smt.executeQuery(qry);
rs.next();
// As the row contains some value which came from Choice.
// When I added it into access table, I wrote:
bla.getSelectedItem();
//In case of setting text:
bla.select("Badminton");
//and it worked.
//But in case of retrieving, I am writing:
String s5,s6;
s5=rs.getString("Sports");
s6=rs.getInt("Fees");
tsp.select(s5);
tfee.select(String.valueOf(s6));
//But again this code is not working and gives SQLException "Invalid cursor state."
//Pls. correct me if possible..