Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / June 2005

Tip: Looking for answers? Try searching our database.

Error on DELETE

Thread view: 
M K - 17 Jun 2005 15:35 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.