| Author |
help with a exception
|
ben riches
Ranch Hand
Joined: Nov 08, 2002
Posts: 126
|
|
hello i hope someone can help me please i have this code but i get a exception the exception says [microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. what does this mean could someone please explain please thanks ben p.s. my code is below import java.sql.*; class JD { public static void main (String[] args) { String data = "jdbc dbc:World Energy"; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn = DriverManager.getConnection(data,"",""); Statement st = conn.createStatement(); st.executeUpdate("INSERT INTO Coal (FIPS, Country, Year)" + "VALUES (gh, 'ghia', 1991)"); conn.close(); } catch (Exception e) { System.err.println("Got an exception! "); System.err.println(e.getMessage()); } } }
|
 |
Mani Ram
Ranch Hand
Joined: Mar 11, 2002
Posts: 1140
|
|
Try this st.executeUpdate("INSERT INTO Coal (FIPS, Country, Year)" + "VALUES ('gh', 'ghia', 1991)"); (Look at the quotes around the gh).
|
Mani
Quaerendo Invenietis
|
 |
 |
|
|
subject: help with a exception
|
|
|