After adding the data to the ResultSet, the final line inserts a new row.

However, to commit any changes to the database what we'll do is to close our
Statement object and our ResultSet object. We can then reload everything. If
we don't do this, there's a danger that the new record won't get added, either
to the ResultSet or the database. (This is due to the type of Driver we've used.)

To close a Statement or a ResultSet, you just issue the close command:

stmt.close( );
rs.close( );

The code to reload everything is the same as the code you wrote when the form
first loads:

You're not doing anything different, here: just selecting all the records again
and putting the first one in the Text Fields.

Here's all the code that saves a new record to the database (Obviously, a lot
of this code could have went into a method of its own):

The code is a bit long, but you can copy and paste a lot of it from your DoConnect
method. (We've Photo-shopped the stmt line because it's too big to fit
on this page. Yours should go on one line).

(One other issue is that the ID column needs to be unique. Ideally, you'd write
a routine to get the last ID number, then add one to it. Other databases, like
MySql, have an AutoIncrement value to take care of these things. Just make sure
that the ID value isn't one you have used before, otherwise you'll get an error
message. Or write a routine to get a unique ID!)

Run your programme and test it out. You now be able to save new records to
your database.