try {
if (System.getProperty("java.vendor").equals("Microsoft Corp."))
Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver");
else // Non-visual J++ Users
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Setup connection to DBMS
Connection conn =
DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver
(*.mdb)};DBQ=C:/MyDocs/My Java/MyProjects/ListSaver2/DCF.mdb");
// Create statement
Statement stmt = conn.createStatement();
String sql;
sql = "DELETE FROM MAIN WHERE name = " +
lstCurrentItems.getSelectedValue().toString();
stmt.executeUpdate(sql); <---- get the following error message:
[Micorsoft][ODBC Microsfot Access Driver] Too few
paramenters. Expected 1.java.sql.SQLException
}catch(Exception ex){
JOptionPane.showMessageDialog(null, ex.getMessage() +
ex.toString(),"Error",
JOptionPane.INFORMATION_MESSAGE);
}
John Currier - 17 Jun 2005 16:29 GMT
Your delete should look something like:
delete from main where name = 'M K'
...you're missing the quotes.
John
M K - 17 Jun 2005 19:45 GMT
I knew that answer.. damn.. Thanks John
> Your delete should look something like:
> delete from main where name = 'M K'
> ...you're missing the quotes.
>
> John