Your list of imports looks fishy. You're importing a class you're not using (DefaultComponentFactory), but you're not importing a class (SwingAction) that you are using. The latter is what the first error message is about. The only reference to SwingAction a quick search brings up is https://support.sas.com/rnd/javadoc/93/Components/com/sas/actionprovider/SwingAction.html - is that what you're trying to use? If so, you need to import it (and put the relevant jar files in the classpath). On the other hand, the code does not use the "action" variable at all, so you could just delete line 48 instead.
As to "btnInsert", you're defining it in line 172, but you're already using it in line 94. You need to define it before you can use it.
The code uses Statement rather than PreparedStatement. While desktop apps don't suffer from the same SQL injection problems web apps do, it is still good practice to us prepared statements which make for easier to write queries, because you don't need to worry about escaping characters, enclosing quotes and such.
posted 11 months ago
now i have properly arranged the imports and removed the unwanted. my code looks less messy, Thanks a lot Tim Moores !
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad: