How To Make button First , Previous , next and Last Swing JDBC
Hi ,
How Can i Move to First , Last ,Previous Rows
using JButton
i have set ResultSet to first beforlast ...
but doesnt seem to work for me
Re: How To Make button First , Previous , next and Last Swing JDBC
What ?
Is it So difficult ?
or i'am Not Clear ?
Re: How To Make button First , Previous , next and Last Swing JDBC
Quote:
Originally Posted by killer7k
What ?
What?
Quote:
Is it So difficult ?
Don't know.
Quote:
or i'am Not Clear ?
That's the one. Perhaps you could explain what you're talking about. We're not mind-readers.
When a programming language is created that allows programmers to program in simple English, it will be discovered that programmers cannot speak English...
Anon.
Re: How To Make button First , Previous , next and Last Swing JDBC
oK !
We Have a Table That Contains some data
I can Get all Data in JTable
& I Can Search for a Row(PrimaryKey) in TextBox
What I need Is To Manipulate The Table
Like If I Click on JButton First They Will Show me The first Row in Textbox
if i click in next JButton You will Show me next one ....
it's like With Ado.net (move first , move last ..)
Re: How To Make button First , Previous , next and Last Swing JDBC
Quote:
Originally Posted by killer7k
We Have a Table That Contains some data
A database table?
Quote:
I can Get all Data in JTable
Good, that helps.
Quote:
I Can Search for a Row(PrimaryKey) in TextBox
Are you saying you enter the key into a text field and somehow the corresponding row in the JTable is selected or highlighted?
Quote:
What I need Is To Manipulate The Table
Like If I Click on JButton First They Will Show me The first Row in Textbox
if i click in next JButton You will Show me next one ....
You want buttons 'First', 'Next', & 'Previous' that will select the first, next, and previous rows from the JTable and also display them in a text field?
Quote:
it's like With Ado.net (move first , move last ..)
What is Ado.net?
If you can't explain it simply, you don't understand it well enough...
A. Einstein
Re: How To Make button First , Previous , next and Last Swing JDBC
oK Lets Forget JTable
let's Say We Have a Table Name : Customer (CustomerId,Name,DateBirth)
& I have 3 JtextField ,
I Have a Jbutton Called Search That Search for a partiular Customer
I enter in JtextField 1 (CustomerID) & It show me his name & DateBirth
That is done work well
what i need Now :
Let's Say We have In The Table 5 Customer
I need When To Click on Jbutton First Show The first Customer in JtextField
& when I click on Next show me Next Customer , & when i Click in Jbutton Last Show me LastOne ...
ado.net (its Vb.Net with Database)
Re: How To Make button First , Previous , next and Last Swing JDBC
If you only have a small number of records, you can read them all into the ResultSet and use the ResultSet methods to access the first, last, next, & previous. If the ResultSet doesn't support all the features you need, you can extract all the records from the ResultSet into an ArrayList (or other ordered collection class) and use the ArrayList methods to access the records you want. In general, it is better to copy records out of the ResultSet and free up the Statement as soon as possible.
If you have a lot of records in the table, it's probably better to use SQL queries to retrieve the first, next, etc.
Everything should be made as simple as possible, but not simpler...
A. Einstein
Re: How To Make button First , Previous , next and Last Swing JDBC
oK !
I have Worked with The ResulSet Well
& There are some method of ResultSet .first() , last()....
but Cant Seem to work for me
have You Succeded To get it to work ?
Re: How To Make button First , Previous , next and Last Swing JDBC
Quote:
Originally Posted by killer7k
There are some method of ResultSet .first() , last()....
but Cant Seem to work for me
Did you set up the Statement to give you a scrollable ResultSet as described in the ResultSet API docs?
Post up the full text of any errors you get.
Quote:
have You Succeded To get it to work ?
I have used a scrollable ResultSet in the past, yes. But as I said, it's really better to copy the records out into a collection.
Imagination is more important than knowledge...
A. Einstein