|
 |
ado_dotnet thread: Re: Retrieving null values from fields using C#/ADO.NET
Message #1 by David.Martret@q... on Tue, 2 Apr 2002 10:13:53 +1000
|
|
I had a similar problem - and found that the ".ToString" method seemed to
convert the null to an empty string that I could check.
However, I also noticed that this method did not "auto-appear" (ie didn't
show up in the drop-down when I typed a ".") - but it works.
I think there may be an integer equivalent? - Or perhaps use the
"ToString", then later (after checking for nulls) convert it back to an
integer using "CInt"
'============
Dim DR As DataRow
...
...
For i = 0 To DR.Table.Columns.Count - 1
Dim myLabel As New Label()
myLabel.Text = DR.Item(i).ToString
...
'============
"Zackery Breen"
<zackery_breen@h... To: "ADO.NET" <ado_dotnet@p...>
tmail.com> cc:
Subject: [ado_dotnet] Retrieving null values from fields using
29/03/02 13:55 C#/ADO.NET
Please respond to
"ADO.NET"
I am trying to retrieve a value from a field that can contain a null value
and
store it into an integer field using the following C#/ADO.NET code:
int Temperature = (int) paramTemperature.Value;
(paramTemperature is an output parameter from a stored procedure)
But I always get an exception if the value is null. I would like to store
the
value into the variable whether it is null or not and then be able to test
for
null at a later point in time.
How can I do this?
Thanks
|
|
 |