News
Forums
Search
Members
Sign Up
My Code Newbie
Username
Password
Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET
C.N. Friends
Planet Rome
Link to Us!
Code Newbie
Code Forums
>
Application and Web Development
>
Java
null items in a record set
User Name
Remember Me?
Password
Register
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
LinkBack
Thread Tools
Display Modes
09-01-2004, 01:51 PM
#
1
(
permalink
)
sde
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,489
null items in a record set
how do i handle a null item in a record set? for example:
Code:
while(rs.next()){ int i = rs.getInt("FIELD_THAT_IS_NULL"); }
i keep getting sql exceptions when i try to use rs.getInt on a field that is null.
__________________
Mike
sde
View Public Profile
Visit sde's homepage!
Find More Posts by sde
09-01-2004, 02:07 PM
#
2
(
permalink
)
sde
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,489
ok, well a work around is to put that code in a try/catch block .. but isn't there a better way to test if a field of a recordset is valid?
__________________
Mike
sde
View Public Profile
Visit sde's homepage!
Find More Posts by sde
09-01-2004, 04:05 PM
#
3
(
permalink
)
Belisarius
Java fanboy
Join Date: Aug 2003
Posts: 1,161
According to the documentation, if the field is null, the value returned is 0. So something wacky is going on there.
__________________
GitS
Belisarius
View Public Profile
Find More Posts by Belisarius
09-01-2004, 04:08 PM
#
4
(
permalink
)
sde
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,489
wacky was me. it returns 0, i thought i had isolated it to that one line of code, but it was another field that i was naming wrong.
__________________
Mike
sde
View Public Profile
Visit sde's homepage!
Find More Posts by sde
Bookmarks
Digg
del.icio.us
StumbleUpon
Google
«
Previous Thread
|
Next Thread
»
Thread Tools
Show Printable Version
Email this Page
Display Modes
Linear Mode
Switch to Hybrid Mode
Switch to Threaded Mode
Posting Rules
You
may not
post new threads
You
may not
post replies
You
may not
post attachments
You
may not
edit your posts
BB code
is
On
Smilies
are
On
[IMG]
code is
On
HTML code is
Off
Trackbacks
are
On
Pingbacks
are
On
Refbacks
are
On
Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Hacking your Linksys WRT54G
sde
Linux / BSD / OS X
18
04-20-2005
03:37 PM
Need help with C++
ewic
Standard C, C++
7
10-01-2004
04:24 AM
OpenGL.dll
Mr.Anderson
Platform/API C++
3
08-13-2004
10:07 AM
what language is this?
sde
All Other Coding Languages
10
05-25-2004
03:57 PM
All times are GMT -8. The time now is
11:37 AM
.
Contact Us
-
CodeNewbie.com
-
Archive
-
Top
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by
vBSEO
3.0.0 RC8
Copyright © 2000-2008,
Milano Interactive
Web Hosting provided by
Portal 360 Web Hosting
LinkBack
LinkBack URL
About LinkBacks