I have a GUI set up so the user can enter SQl commands. I have two tables set up in an Access DB. I have been able to do query commands OK as well as insert and delete but have been having problems with drop table and create table. Everytime I try to create a table it says that table already exists but I know it doesn't. If I try to drop the table I get an error say that the table doesn't exist. Part of my problem is I don't fully understand how drop and create commands work. Below is the code I am using to execute any SQL commands entered. I have some extra displays in there to help me troubleshoot the problem. Any suggestions?
Based on the above code it appears you executing the same SQL command twice. So if you for example say drop a table, the first time the command will succeed, the second time it will say something like the table does not exist. I hope this helps. Craig.
Joined: Jan 28, 2004
Thanks CJ. I removed sqlResults = statement.executeQuery(strQuery); AND rowCount = statement.executeUpdate(strQuery); Things seem to working now. By the way is there a way to tell if you are Dropping a table or creating one? Thanks, Craig