Hi!
please help me for how can i scroll through database using JDBC.
if i m creating 4 buttons say First,Last,Next,Previous.
First button will take me to the first record of the database.
Last button will take me to the last record of the database.
Next and Previous will show next and previous records respectively.
Any one can please help me by giving source code for this problem.

Thanks

Load all the data of the database into a list of objects.
Have a separate method in a separate class that handles the connection with the database and returns that list of objects

Then since you have that list, you can display the element of the list. Have a variable for the current item's index of the list

When the FIRST button is clicked display the list.get(0) and make that index=0
For NEXT increase the index (index++) and display the list.get(index)
For PREVIOUS decrease the index (index--) and display the list.get(index)
For LAST make the index=list.size()-1 and display the list.get(index)


Create your classes separately and test them separately. Start with the class for the database. Create your method, run it in a main method and see if it works.
Then create the GUI and try to test the buttons.
Then call your method at the gui and access its elements.

For the database you can find plenty of examples. Let us see your version.
For the gui check out some tutorials.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.