By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,569 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,569 IT Pros & Developers. It's quick & easy.

Set a Field to Null

P: n/a
I am trying to set a field to Null using code such as:

dr("Contact2") = DBNull

But VB.NET won't accept that. I tried:

dr("Contact2") = Nothing

but that tells me to use DBNull

What is the correct syntax to accomplish this?

Wayne
Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
* "Wayne Wengert" <wa***************@wengert.com> scripsit:
I am trying to set a field to Null using code such as:

dr("Contact2") = DBNull


'DBNull.Value'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2

P: n/a
dr("Contact2") = DBNull.Value

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...
I am trying to set a field to Null using code such as:

dr("Contact2") = DBNull

But VB.NET won't accept that. I tried:

dr("Contact2") = Nothing

but that tells me to use DBNull

What is the correct syntax to accomplish this?

Wayne

Nov 21 '05 #3

P: n/a
Herfried & Shiva;

Thanks. Why do they do that? Null is always confusing enough to deal with!

Wayne

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...
I am trying to set a field to Null using code such as:

dr("Contact2") = DBNull

But VB.NET won't accept that. I tried:

dr("Contact2") = Nothing

but that tells me to use DBNull

What is the correct syntax to accomplish this?

Wayne

Nov 21 '05 #4

P: n/a
Hi,
Since DBNull is a class name, you use the Value property of it to get an
instance, which in turn used to assign for null values.

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl...
Herfried & Shiva;

Thanks. Why do they do that? Null is always confusing enough to deal with!

Wayne

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...
I am trying to set a field to Null using code such as:

dr("Contact2") = DBNull

But VB.NET won't accept that. I tried:

dr("Contact2") = Nothing

but that tells me to use DBNull

What is the correct syntax to accomplish this?

Wayne


Nov 21 '05 #5

P: n/a

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl...
Herfried & Shiva;

Thanks. Why do they do that?


It's the Object Oriented way. You will be assimilated.
Nov 21 '05 #6

P: n/a
I surrender - I am just slow!!!!

"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message
news:ee****************@tk2msftngp13.phx.gbl...

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl...
Herfried & Shiva;

Thanks. Why do they do that?


It's the Object Oriented way. You will be assimilated.

Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.