Delete a Record from a Database – Free Java Tutorials for Beginners 13.8

Posted by NosaLee in Java Programming on 25-05-2012. Tags: , ,

Back to Home Previous Course
Deleting a row can be straightforward: Just use deleteRow method of the ResultSet:
rs.deleteRow( );
However, the Driver we are using, the ClientDriver, leaves a blank row in place of the data that was deleted. If you try to move to that row using your Next or Previous bu[......]

Read More…

Save a New Record – Free Java Tutorials for Beginners 13.7

Posted by NosaLee in Java Programming on 25-05-2012. Tags: , ,

Back to Home Previous Course Next Course
Before you can save a new record, you have to move the Cursor to something called the Insert Row. This creates a blank record in the ResultSet. You then add the data to the ResultSet:
rs.moveToInsertRow( );
rs.updateInt(“ID”, newID);
rs.updateStri[......]

Read More…

Add a New Record – Free Java Tutorials for Beginners 13.6

Posted by NosaLee in Java Programming on 25-05-2012. Tags: , ,

Back to Home Previous Course Next Course
We have three buttons that refer to new records: New Record, Save New Record, and Cancel New Record. The New Record button will only clear the Text Fields, and ready them for new data to be entered. We can also disable some other buttons, including the New Re[......]

Read More…

Updating a Record – Free Java Tutorials for Beginners 13.5

Posted by NosaLee in Java Programming on 25-05-2012. Tags: , ,

Back to Home Previous Course Next Course
The ResultSet has Update methods that allow you to update records not only in the ResultSet itself, but in the underlying database. Let’s see how it works.
Make your form a bit longer. Now add a new panel to the form. Add a new button to the panel. Chan[......]

Read More…

Move to the First and Last Records – Free Java Tutorials for Beginners 13.4

Posted by NosaLee in Java Programming on 25-05-2012. Tags: , ,

Back to Home Previous Course Next Course
Moving to the first and last records of your database is a lot easier.
Double click your First button to create the code stub. Now add the following code:
Java code to move to the First record in a ResultSet
We have no need of an IF … ELSE Statement, now. The only thing we need to do is move the Cursor t[......]

Read More…

Move Back through a Database – Free Java Tutorials for Beginners 13.3

Posted by NosaLee in Java Programming on 25-05-2012. Tags: , ,

Back to Home Previous Course Next Course
The code for the Previous button is similar to the Next button. But instead of using rs.Next, you use rs.Previous.
Return to the Design window and double click your Previous button to create a code stub.
Instead of typing out all that code again, simply copy [......]

Read More…

Database Scrolling Buttons – Free Java Tutorials for Beginners 13.2

Posted by NosaLee in Java Programming on 25-05-2012. Tags: , ,

Back to Home Previous Course Next Course
What we’ll do now is to add four buttons to the form. The buttons will enable us to move forward through the records, move back, move to the last record, and move to the first record.
So add a new panel to your form. Enlarge it and then add for buttons [......]

Read More…

Databases and Java Forms – Free Java Tutorials for Beginners 13.1

Posted by NosaLee in Java Programming on 25-05-2012. Tags: , ,

Back to Home Previous Course Next Course
In this section, you’ll create a form with buttons and text fields. The buttons will be used to scroll forwards and backwards through the records in a database table. We’ll also add buttons to perform other common database tasks. The form you̵[......]

Read More…

Connecting to a Database Table – Free Java Tutorials for Beginners 12.6

Posted by NosaLee in Java Programming on 25-05-2012. Tags: , ,

Back to Home Previous Course Next Course
Now that you have connected to the database, the next step is to access the table in your database. For this, you need to execute a SQL Statement, and then manipulate all the rows and columns that were returned.
To execute a SQL statement on your table, you s[......]

Read More…

Connect to a Database Using Java Code – Free Java Tutorials for Beginners 12.5

Posted by NosaLee in Java Programming on 25-05-2012. Tags: , ,

Back to Home Previous Course Next Course
In a later section, you’ll create a Java form that loads information from a database. The form will have Next and Previous to scroll through the data. Individual records will then be displayed in text fields. We’ll also add button to Update a reco[......]

Read More…