Thread View: borland.public.jbuilder.java.swing
5 messages
5 total messages
Started by Pep
Sat, 18 Jun 2005 19:57
Retrieve int data from a table
Author: Pep
Date: Sat, 18 Jun 2005 19:57
Date: Sat, 18 Jun 2005 19:57
18 lines
1469 bytes
1469 bytes
Hello. I have a problem retrieving the data from a table. When I select a row of data (which I retrieve from a mysql database) one of the columns is an integer type and the others are varchar. I use the next --(String)model.getValueAt(selectedRow, 0)-- to take the value from the row selectedRow and the column 0, and everything is ok. When I try to retrieve the value of a column which store an int type (int in myql), I can't get the value and I can't do the next: (int)model.getValueAt(selectedRow, 3) How can I retrieve this value to store in an int variable???? Thanks
Re: Retrieve int data from a table
Author: Alexey N. Solofnenko
Date: Sat, 18 Jun 2005 20:15
Date: Sat, 18 Jun 2005 20:15
31 lines
1847 bytes
1847 bytes
You will need to cast it to Integer first. Then depending on your Java version, 5.0 Java itself can unbox Integer into int, or call intValue() method. - Alexey. Pep wrote: > Hello. > > I have a problem retrieving the data from a table. When I select a row of > data (which I retrieve > from a mysql database) one of the columns is an integer type and the others > are varchar. > > I use the next --(String)model.getValueAt(selectedRow, 0)-- to take the > value from the row selectedRow > and the column 0, and everything is ok. > > When I try to retrieve the value of a column which store an int type (int > in myql), I can't get > the value and I can't do the next: (int)model.getValueAt(selectedRow, 3) > > How can I retrieve this value to store in an int variable???? > > Thanks > > -- Alexey N. Solofnenko home: http://trelony.cjb.net/
Re: Retrieve int data from a table
Author: Pep
Date: Sat, 18 Jun 2005 23:11
Date: Sat, 18 Jun 2005 23:11
46 lines
2198 bytes
2198 bytes
Hello. I cast (or I try) to int (int)model.getValueAt(selectedRow, 3) and I've used (Integer)model.getValueAt(selectedRow, 3) too, but no way. The version I use is 1.4.2_06 Any other suggestion? Thanks "Alexey N. Solofnenko" <nospam@nospam.comp> escribi� en el mensaje news:42b480d7$1@newsgroups.borland.com... > You will need to cast it to Integer first. Then depending on your Java > version, 5.0 Java itself can unbox Integer into int, or call intValue() > method. > > - Alexey. > > Pep wrote: >> Hello. >> >> I have a problem retrieving the data from a table. When I select a row of >> data (which I retrieve >> from a mysql database) one of the columns is an integer type and the >> others are varchar. >> >> I use the next --(String)model.getValueAt(selectedRow, 0)-- to take the >> value from the row selectedRow >> and the column 0, and everything is ok. >> >> When I try to retrieve the value of a column which store an int type >> (int in myql), I can't get >> the value and I can't do the next: (int)model.getValueAt(selectedRow, 3) >> >> How can I retrieve this value to store in an int variable???? >> >> Thanks > > -- > Alexey N. Solofnenko > home: http://trelony.cjb.net/
Re: Retrieve int data from a table
Author: Tony
Date: Sat, 18 Jun 2005 23:28
Date: Sat, 18 Jun 2005 23:28
57 lines
2470 bytes
2470 bytes
Could it be someting trivial? int myVar = ((Integer)model.getValueAt(selectedRow, 3)).intValue(); Tony. "Pep" <pep@yahoo.com> wrote in message news:42b4aa37@newsgroups.borland.com... > Hello. > > I cast (or I try) to int > (int)model.getValueAt(selectedRow, 3) > and I've used (Integer)model.getValueAt(selectedRow, 3) too, but no way. > > The version I use is 1.4.2_06 > > Any other suggestion? > > Thanks > > > > > "Alexey N. Solofnenko" <nospam@nospam.comp> escribi� en el mensaje > news:42b480d7$1@newsgroups.borland.com... >> You will need to cast it to Integer first. Then depending on your Java >> version, 5.0 Java itself can unbox Integer into int, or call intValue() >> method. >> >> - Alexey. >> >> Pep wrote: >>> Hello. >>> >>> I have a problem retrieving the data from a table. When I select a row >>> of data (which I retrieve >>> from a mysql database) one of the columns is an integer type and the >>> others are varchar. >>> >>> I use the next --(String)model.getValueAt(selectedRow, 0)-- to take the >>> value from the row selectedRow >>> and the column 0, and everything is ok. >>> >>> When I try to retrieve the value of a column which store an int type >>> (int in myql), I can't get >>> the value and I can't do the next: (int)model.getValueAt(selectedRow, >>> 3) >>> >>> How can I retrieve this value to store in an int variable???? >>> >>> Thanks >> >> -- >> Alexey N. Solofnenko >> home: http://trelony.cjb.net/ > >
Re: Retrieve int data from a table
Author: Pep
Date: Mon, 20 Jun 2005 10:01
Date: Mon, 20 Jun 2005 10:01
63 lines
2679 bytes
2679 bytes
Great. Thanks "Tony" <aoganesi_a^t_yahoo_._com> escribi� en el mensaje news:42b4ae13$1@newsgroups.borland.com... > Could it be someting trivial? > > int myVar = ((Integer)model.getValueAt(selectedRow, 3)).intValue(); > > Tony. > > "Pep" <pep@yahoo.com> wrote in message > news:42b4aa37@newsgroups.borland.com... >> Hello. >> >> I cast (or I try) to int >> (int)model.getValueAt(selectedRow, 3) >> and I've used (Integer)model.getValueAt(selectedRow, 3) too, but no way. >> >> The version I use is 1.4.2_06 >> >> Any other suggestion? >> >> Thanks >> >> >> >> >> "Alexey N. Solofnenko" <nospam@nospam.comp> escribi� en el mensaje >> news:42b480d7$1@newsgroups.borland.com... >>> You will need to cast it to Integer first. Then depending on your Java >>> version, 5.0 Java itself can unbox Integer into int, or call intValue() >>> method. >>> >>> - Alexey. >>> >>> Pep wrote: >>>> Hello. >>>> >>>> I have a problem retrieving the data from a table. When I select a row >>>> of data (which I retrieve >>>> from a mysql database) one of the columns is an integer type and the >>>> others are varchar. >>>> >>>> I use the next --(String)model.getValueAt(selectedRow, 0)-- to take the >>>> value from the row selectedRow >>>> and the column 0, and everything is ok. >>>> >>>> When I try to retrieve the value of a column which store an int type >>>> (int in myql), I can't get >>>> the value and I can't do the next: (int)model.getValueAt(selectedRow, >>>> 3) >>>> >>>> How can I retrieve this value to store in an int variable???? >>>> >>>> Thanks >>> >>> -- >>> Alexey N. Solofnenko >>> home: http://trelony.cjb.net/ >> >> > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads