473,385 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Object null but read as empty?

I have this

object o = ds.Tables[0].Rows[i].ItemArray[j];

the item read from my dataset is null. I check on the next line :

if(o!= null)
//then do something

My prob is the object o is getting passed that if statement then i crash, in
debug it shows it with a value of {}.

So what does "{}" mean and how do i check for that?
And why does it not get set to null?

Its read from a database and the value is null there.

Thanks
Mar 29 '07 #1
2 5320

"PokerMan" <no****@pokercat.co.ukwrote in message
news:OA*************@TK2MSFTNGP05.phx.gbl...
>I have this

object o = ds.Tables[0].Rows[i].ItemArray[j];

the item read from my dataset is null. I check on the next line :

if(o!= null)
//then do something

My prob is the object o is getting passed that if statement then i crash,
in debug it shows it with a value of {}.

So what does "{}" mean and how do i check for that?
And why does it not get set to null?

Its read from a database and the value is null there.

Thanks
The {} represents DbNull, I think. If I'm right, you'll need to check for
DbNull and not for null.

Cheers
Peter
Mar 29 '07 #2
Hi,

Cause a "null" ni the DB is interpreted as DBNull.Value in the code.

Check for DBNull.Value instead
"PokerMan" <no****@pokercat.co.ukwrote in message
news:OA*************@TK2MSFTNGP05.phx.gbl...
>I have this

object o = ds.Tables[0].Rows[i].ItemArray[j];

the item read from my dataset is null. I check on the next line :

if(o!= null)
//then do something

My prob is the object o is getting passed that if statement then i crash,
in debug it shows it with a value of {}.

So what does "{}" mean and how do i check for that?
And why does it not get set to null?

Its read from a database and the value is null there.

Thanks

Mar 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Robert Mark Bram | last post by:
Hi All! I have checked Windows Script help for the Undefined Data Type. It says I should be able to do this: // This method will work if (typeof(x) == "undefined") // do something However,...
6
by: Luke | last post by:
Here is my emails to Danny Goodman (but probably he is very busy so he didn't answered it). First email(simple): Subject: JavaScript Arrays " We all know the array can act like HashMap, but is...
1
by: David Lozzi | last post by:
Howdy, I am trying to accomplish the following: dim DateSend as date if txtDateSend.text = "" then DateSend = dbnull.value else DateSend = txtDateSend.text
7
by: Martin Robins | last post by:
I am currently looking to be able to read information from Active Directory into a data warehouse using a C# solution. I have been able to access the active directory, and I have been able to return...
26
by: Martin R | last post by:
Hi, How to find first not null value in column whitout chacking whole table (if there is a not null value then show me it and stop searching, the table is quite big)? thx, Martin *** Sent...
0
by: webmaster | last post by:
Pardon my being a total C# noob. I'm trying to take apart the dotNet Time Tracker dotNet C# starterkit sample application and replicate a part of the code. At a high level, I have a very...
3
by: Simon Hart | last post by:
Hi, I am trying to implement some functionality as seen in MS CRM 3.0 whereby a basic Xml is deserialized into an object which contains properties. What I want to do from here is; cast the basic...
8
by: =?Utf-8?B?QXNo?= | last post by:
Hi, I have an object, for example User. User contains various properties which i have been able to bind to successfully using wizards and the form view. However if the class User has a property...
2
by: Frank | last post by:
Hi All, I've been yanking my hair out all day over this one, and finally decided to grab some sample code from MSDN, only to find the exact same problem What's the problem? The problem is...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.