• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question on the data type short

 
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When looping through a SQL ResultSet, I am adding the attributes of a resultset to an object called Card. In my card object there is a variable defined as: private short cardSequence

When stepping through the WHILE statement below to populate my Card object from the resultset, when I get to populating the property called cardSequence I exit the while statement and my Card object is NOT populated.

In the SQL table the column for cardSequence is a datatype of "smallint". What should I be using to populate the property called cardSequence so that my object gets populated completely?



Any help/direction would be appreciated. Thanks.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Melinda Savoy wrote:When stepping through the WHILE statement below to populate my Card object from the resultset, when I get to populating the property called cardSequence I exit the while statement and my Card object is NOT populated.


Why not? Does an exception occur? Is your code catching the exception and printing the error message? If yes, then please post the exact error message.

Could it be that the column is null in the database?

Also note that in lines 21 and 22 you're getting the same column, named "Sequence", twice. Is that really what you intended?
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about an exception was caught and it states: Exception caught: com.microsoft.sqlserver.jdbc.SQLServerException: The column name Sequence is not valid.

The SP was different than my SQL statement. Sorry about that. Thanks for the help.

Regards.

 
Sheriff
Posts: 22787
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure you have a column named "Sequence"?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic