Hi, i m using ms access as backend. i am having a field "question_no" with data type Number when i am trying to get the value with getObject() method of ResultSet i am getting SQLException saying that : No Data Found although i m able to get other data which is in terms of string i m geeting the data using.. if(row.getObject("question_no")!=null) questionNo=((Integer)row.getObject("question_no")).intValue(); Since i want to check for null value also i don't eant to use getInt() method.. What could be wrong?? Thanks in advance.. Bhupendra
I think the problem is that you are trying to access the same column twice. You are calling getObject() twice. You can retrieve the data the first time, and then use the wasNull() emthod to check if the columns read was null. Check the API for the wasNull() method.
Bosun
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Mahajan Bhupendra
Ranch Hand
Joined: Dec 01, 2000
Posts: 118
posted
0
Yes Bosun, u r right i converted the code like this.. Object ob=row.getObject("question_no"); if(ob!=null) questionNo=((Integer)ob).intValue(); but don't u think i m wasting one object??? BTW Thanx Bhupendra
why do you not want to use the getInt() method? maybe we can help you use a cleaner methodology for attaining your goal(and maybe not!). It just seems like there is a whole lot of stuff going on, when a method (getInt()) already exists. my suggestion is:
Read the docs about ResultSet.wasNull() method to see if it can achieve the same goal Jamie
[This message has been edited by Jamie Robertson (edited October 11, 2001).]