i have this code
try {
String url = "jdbc:mysql://localhost/cyclingclub";
java.sql.Connection conn = DriverManager.getConnection(url,"root","milan");
java.sql.Statement stmt = conn.createStatement();
ResultSet rs;
rs = stmt.executeQuery("SELECT * FROM BicycleDetail");
while ( rs.next() ) {
String mdl = rs.getString("model");
String make = rs.getString("make");
String typ = rs.getString("type");
System.out.println(mdl);
System.out.println(make);
System.out.println(typ);
System.out.println("----------------------------");
}
conn.close();
} catch (Exception e) {
System.err.println("Got an exception! ");
System.err.println(e.getMessage());
}
--this code prints out for me the model/make/type of bicycle in my db...now i want to extract only one make of bicycles, but when the sql statement is modified like this to extract from db only bmx's an error saying incorrect sql stment occurs:
rs = stmt.executeQuery("SELECT * FROM BicycleDetail WHERE make = bmx ");
can pls some one guide me what i'm doing wrong in this?
Thanks.....

New Topic/Question
Reply




MultiQuote



|