DataRow Question

  • Thread starter Thread starter Goofy
  • Start date Start date
G

Goofy

Hi,

I have a row in a dataset table which is nullable ( and also on the sql
backend ), but how can I set it to a null.

if I try Myrow.myDate = nothing

when I test the row, I get "#12:00AM" why ??

?? IDEAS ??
 
I believe the problem is that DateTime is a value type and therefore can't
be null. What value specifically do you want it to be? Do you need to
filter or do a IsDbNull.Value check?
 
To set it to null, try setting it to DBNull.Value.

Robin S.
---------------------------------------
W.G. Ryan said:
I believe the problem is that DateTime is a value type and therefore
can't be null. What value specifically do you want it to be? Do you
need to filter or do a IsDbNull.Value check?
 
Goofy,

Because that is the way the debugger is representing it in VB.Net

The debugger is not showing it so nice in VB.Net as in C#.

In VB.Net is still the old representation used which is only based on USA
standards.

(While the date in Net starts in the year 1 in the first month at 12
o'clock, be aware that it is not correct because it is only a calculating
back from our Gregorian time. That time representation was not used in those
days)

Cor
 
Acutally it wont let you, I found a method for the column ( as I am using
Typed DataSets ) which allows me to set to null

Its all a bit fiddly if you want to enable nulls in the database, but Ive
dont it now.

Thanks to all for help.



RobinS said:
To set it to null, try setting it to DBNull.Value.

Robin S.
 
Hi Cor, thanks for your reply.

I found that the answer was to use the Set(ColumnNam)toNull, this way you
can then test for null instead of using the value, and subsitute the null
value when writing to the SQL SERVER.

Cheers - Goofy


Cor Ligthert said:
Goofy,

Because that is the way the debugger is representing it in VB.Net

The debugger is not showing it so nice in VB.Net as in C#.

In VB.Net is still the old representation used which is only based on USA
standards.

(While the date in Net starts in the year 1 in the first month at 12
o'clock, be aware that it is not correct because it is only a calculating
back from our Gregorian time. That time representation was not used in
those days)

Cor
 
Back
Top