473,786 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5339

"PokerMan" <no****@pokerca t.co.ukwrote in message
news:OA******** *****@TK2MSFTNG P05.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****@pokerca t.co.ukwrote in message
news:OA******** *****@TK2MSFTNG P05.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
3131
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, I have found that when I try to get something from Session and Request that does not exist, the object coming back from each is different
6
2343
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 there a shortcut for creating such array ? eg //simple array indexed via numbers var a = new Array("a", "fdsf", "sada"); or,
1
2942
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
11958
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 "DirectoryEntry" objects within the path that I specify (either using the DirectoryEnrtry.Children or using the DirectorySearcher class) and all started well and dandy! Now the problem; some of the properties of the DirectoryEntry objects being...
26
30937
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 via Developersdex http://www.developersdex.com ***
0
3493
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 simple SQL server table and stored procedure which I have no problems binding from directly from an ASP.NET control... Table BOOK
3
2050
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 object into a more strongly typed class which knows what properties to expect. The basic top level class is as follows: using System;
8
11972
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 which is not a string, for example a custom type Address which contains properties such as StreetAddress, City, County, Country etc how do i bind to those properties on the same form view? I have tried doing Bind("Address.StreetAddress") but...
2
4704
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 that the call to Deserialize( ... ) is returning an empty object and I don't understand why? oItem = (OrderedItem) serializer.Deserialize(reader); <= That line
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9492
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.