473,398 Members | 2,113 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,398 software developers and data experts.

Null value

How do I check if an object is null in vb? I tried using IsDBNull but it
doesn't work at all. It gives me this error when I try statement like If Not
IsDBNull(theStock.WIPQty) Then:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Nov 19 '05 #1
7 1601
IsDBNull is to check for NULL for values coming from a DB. Here it looks
like that "theStock" is Nothing (null in C#).

Patrice

--

"wrytat" <wr****@discussions.microsoft.com> a écrit dans le message de
news:DF**********************************@microsof t.com...
How do I check if an object is null in vb? I tried using IsDBNull but it
doesn't work at all. It gives me this error when I try statement like If Not IsDBNull(theStock.WIPQty) Then:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Nov 19 '05 #2
Oh~ Then how do I check that if it is null in VB?

"Patrice" wrote:
IsDBNull is to check for NULL for values coming from a DB. Here it looks
like that "theStock" is Nothing (null in C#).

Patrice

--

"wrytat" <wr****@discussions.microsoft.com> a écrit dans le message de
news:DF**********************************@microsof t.com...
How do I check if an object is null in vb? I tried using IsDBNull but it
doesn't work at all. It gives me this error when I try statement like If

Not
IsDBNull(theStock.WIPQty) Then:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information

about
the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.


Nov 19 '05 #3
If (yourobject Is Nothing) Then

"wrytat" <wr****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
Oh~ Then how do I check that if it is null in VB?

"Patrice" wrote:
IsDBNull is to check for NULL for values coming from a DB. Here it looks
like that "theStock" is Nothing (null in C#).

Patrice

--

"wrytat" <wr****@discussions.microsoft.com> a écrit dans le message de
news:DF**********************************@microsof t.com...
> How do I check if an object is null in vb? I tried using IsDBNull but
> it
> doesn't work at all. It gives me this error when I try statement like
> If

Not
> IsDBNull(theStock.WIPQty) Then:
>
> Object reference not set to an instance of an object.
> Description: An unhandled exception occurred during the execution of
> the
> current web request. Please review the stack trace for more information

about
> the error and where it originated in the code.
>
> Exception Details: System.NullReferenceException: Object reference not
> set
> to an instance of an object.
>


Nov 19 '05 #4
>> IsDBNull is to check for NULL for values coming from a DB. Here it looks
like that "theStock" is Nothing (null in C#).
Oh~ Then how do I check that if it is null in VB?
ROFLMOD!

Never mind. It's Nothing.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"wrytat" <wr****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com... Oh~ Then how do I check that if it is null in VB?

"Patrice" wrote:
IsDBNull is to check for NULL for values coming from a DB. Here it looks
like that "theStock" is Nothing (null in C#).

Patrice

--

"wrytat" <wr****@discussions.microsoft.com> a écrit dans le message de
news:DF**********************************@microsof t.com...
> How do I check if an object is null in vb? I tried using IsDBNull but
> it
> doesn't work at all. It gives me this error when I try statement like
> If

Not
> IsDBNull(theStock.WIPQty) Then:
>
> Object reference not set to an instance of an object.
> Description: An unhandled exception occurred during the execution of
> the
> current web request. Please review the stack trace for more information

about
> the error and where it originated in the code.
>
> Exception Details: System.NullReferenceException: Object reference not
> set
> to an instance of an object.
>


Nov 19 '05 #5
Ok Thanks. Actually what is the difference between null value and nothing?
Very complicated...

"MW de Jager" wrote:
If (yourobject Is Nothing) Then

"wrytat" <wr****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
Oh~ Then how do I check that if it is null in VB?

"Patrice" wrote:
IsDBNull is to check for NULL for values coming from a DB. Here it looks
like that "theStock" is Nothing (null in C#).

Patrice

--

"wrytat" <wr****@discussions.microsoft.com> a écrit dans le message de
news:DF**********************************@microsof t.com...
> How do I check if an object is null in vb? I tried using IsDBNull but
> it
> doesn't work at all. It gives me this error when I try statement like
> If
Not
> IsDBNull(theStock.WIPQty) Then:
>
> Object reference not set to an instance of an object.
> Description: An unhandled exception occurred during the execution of
> the
> current web request. Please review the stack trace for more information
about
> the error and where it originated in the code.
>
> Exception Details: System.NullReferenceException: Object reference not
> set
> to an instance of an object.
>


Nov 19 '05 #6
NULL in a database means that the value is not "defined" (i.e. if the price
column for the product is NULL the price is not known, 0 would mean it is
free). This is called DBNull in .NET.

"Nothing" (null in C#) means that the object doesn't exist... (basically
objects are pointers, it means that this pointer is not yet defined).

Patrice

--

"wrytat" <wr****@discussions.microsoft.com> a écrit dans le message de
news:1E**********************************@microsof t.com...
Ok Thanks. Actually what is the difference between null value and nothing?
Very complicated...

"MW de Jager" wrote:
If (yourobject Is Nothing) Then

"wrytat" <wr****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
Oh~ Then how do I check that if it is null in VB?

"Patrice" wrote:

> IsDBNull is to check for NULL for values coming from a DB. Here it looks> like that "theStock" is Nothing (null in C#).
>
> Patrice
>
> --
>
> "wrytat" <wr****@discussions.microsoft.com> a écrit dans le message de> news:DF**********************************@microsof t.com...
> > How do I check if an object is null in vb? I tried using IsDBNull but> > it
> > doesn't work at all. It gives me this error when I try statement like> > If
> Not
> > IsDBNull(theStock.WIPQty) Then:
> >
> > Object reference not set to an instance of an object.
> > Description: An unhandled exception occurred during the execution of> > the
> > current web request. Please review the stack trace for more information> about
> > the error and where it originated in the code.
> >
> > Exception Details: System.NullReferenceException: Object reference not> > set
> > to an instance of an object.
> >
>
>
>


Nov 19 '05 #7
The difference between null and Nothing is the language you're coding in.
"null" is C# for "Nothing" in VB, which is "nada" in Espanol. However,
Espanol is not a programming language. ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"wrytat" <wr****@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
Ok Thanks. Actually what is the difference between null value and nothing?
Very complicated...

"MW de Jager" wrote:
If (yourobject Is Nothing) Then

"wrytat" <wr****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
> Oh~ Then how do I check that if it is null in VB?
>
> "Patrice" wrote:
>
>> IsDBNull is to check for NULL for values coming from a DB. Here it
>> looks
>> like that "theStock" is Nothing (null in C#).
>>
>> Patrice
>>
>> --
>>
>> "wrytat" <wr****@discussions.microsoft.com> a écrit dans le message de
>> news:DF**********************************@microsof t.com...
>> > How do I check if an object is null in vb? I tried using IsDBNull
>> > but
>> > it
>> > doesn't work at all. It gives me this error when I try statement
>> > like
>> > If
>> Not
>> > IsDBNull(theStock.WIPQty) Then:
>> >
>> > Object reference not set to an instance of an object.
>> > Description: An unhandled exception occurred during the execution of
>> > the
>> > current web request. Please review the stack trace for more
>> > information
>> about
>> > the error and where it originated in the code.
>> >
>> > Exception Details: System.NullReferenceException: Object reference
>> > not
>> > set
>> > to an instance of an object.
>> >
>>
>>
>>


Nov 19 '05 #8

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

Similar topics

3
by: John Morgan | last post by:
In an SQL statement which concatenates several fields I get a null value returned if any one of the fields are null. Is this to be expected? For example : SELECT tblMember.memberAddress + '...
3
by: Robb Gilmore | last post by:
Hello, We have a C#.NET app which is calling a Java webservice. We use the wsdl file exportted from the java webservice to create our web-reference in Visual Studio. We are able to create the...
2
by: PK | last post by:
Hi, I have an application that opens a Crystal report document and passes in a value to a parameter in the report (pointing to an Oracle DB). However, if I want to pass a "null" value to retrieve...
3
by: Robert | last post by:
I need to be able to send a null value into a Sql Server datetime field. The follolwing code is a snippet of what I am using. I am parsing a flat file from the main frame and inserting it into a...
15
by: TC | last post by:
What does it mean for an integer to have a null value? I am trying to use the DataView.Find method. That method has an integer return type which contains the "index of the row in the DataView...
1
by: David Shorthouse | last post by:
Hey folks, I am attempting to pass null as the input value from a series of textboxes if the user does not input a value prior to submit. To try and do this, I am using a vbscript function on...
7
by: kumar.senthil | last post by:
Hi, I'm using XmlSerializer to create an object from the XML string. I would like to know whether I can get a null value for an empty XML element. Actually the XmlSerializer assigns "" (empty...
7
by: monika varshney | last post by:
I have to read a database using dataset. My database has some null values. My code is working fine when there is a value in the database. But when there is a null value in the database, dataset...
0
prabirchoudhury
by: prabirchoudhury | last post by:
CRITERIA; +-------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+-------+...
2
by: qwedster | last post by:
Folk! How to programattically check if null value exists in database table (using stored procedure)? I know it's possble in the Query Analyzer (see last SQL query batch statements)? But how...
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.