Newbies nycguy Posted January 30, 2003 Newbies Posted January 30, 2003 Can someone post a short quick example of how to do a simple insert into FM Pro 6? Every time I try to do a simple insert (1 column) it says "Database closed" however as soon as I replace the SQL with an update, it works fine. Why does it say the databse is closed when I try to do an insert but works OK with an update?!? I tried: <standard conection stuff> Connection conn=DriverManager.getConnection(...) PreparedStatement ps=conn.prepareStatement("INSERT INTO "DATABASE.FP5" ("CUSTOMER") VALUES ('JOHN')"); ps.executeUpdate(); Is this correct to use a prepared statement with an executeUpdate? Or should I use a regular statement and do a statement.executeQuery() (actually i tried this and it didnt work either, but... im still not sure which way to fiddle around with more.) Any help appreciated, this is driving me nuts and this project is supposed to be done next week. Thanks!!
Newbies nycguy Posted January 30, 2003 Author Newbies Posted January 30, 2003 Nevermind i figured it out, I had a space in the table name where i shouldnt have. () Anyway, in case anyone else needs to know what method to use, use the PreparedStatement with conn.preparestatement and not statement.executeQuery!!!
Recommended Posts
This topic is 7966 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now