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

About Insert Null to DateTime Field

P: n/a
When I using dataset to append
a null value to the datetime field.

It throw a error -> can not convert db.null to system.date

Can there is any standard to pass a Null value
to the DateTime Field!
(It is successful to pass the Null Value to other type of
Field)
Nov 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
You can pass nulls to other types, but not to a system.datetime. I instead
set it to system.datetime.minvalue and then test for that in my code as if
it was a null.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"FatboyCanteen" <ze*******@fatboycanteen.com> wrote in message
news:06****************************@phx.gbl...
When I using dataset to append
a null value to the datetime field.

It throw a error -> can not convert db.null to system.date

Can there is any standard to pass a Null value
to the DateTime Field!
(It is successful to pass the Null Value to other type of
Field)

Nov 17 '05 #2

P: n/a
Thank You for your reply!
Yes, I am using your method in the past (but using max
value)
However, I want to know anyone can successful insert a
null value to DateTime Field.
-----Original Message-----
You can pass nulls to other types, but not to a system.datetime. I insteadset it to system.datetime.minvalue and then test for that in my code as ifit was a null.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"FatboyCanteen" <ze*******@fatboycanteen.com> wrote in messagenews:06****************************@phx.gbl...
When I using dataset to append
a null value to the datetime field.

It throw a error -> can not convert db.null to system.date
Can there is any standard to pass a Null value
to the DateTime Field!
(It is successful to pass the Null Value to other type of Field)

.

Nov 17 '05 #3

P: n/a
Take a look @ http://www.c-sharpcorner.com/Code/20...orDateTime.asp

HTH
-Sushila

"FatboyCanteen" <ze*******@fatboycanteen.com> wrote in message news:07****************************@phx.gbl...
Thank You for your reply!
Yes, I am using your method in the past (but using max
value)
However, I want to know anyone can successful insert a
null value to DateTime Field.


-----Original Message-----
You can pass nulls to other types, but not to a

system.datetime. I instead
set it to system.datetime.minvalue and then test for

that in my code as if
it was a null.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"FatboyCanteen" <ze*******@fatboycanteen.com> wrote in

message
news:06****************************@phx.gbl...
When I using dataset to append
a null value to the datetime field.

It throw a error -> can not convert db.null to system.date
Can there is any standard to pass a Null value
to the DateTime Field!
(It is successful to pass the Null Value to other type of Field)

.


Nov 17 '05 #4

P: n/a
i use the following to insert NULL into datetime field and it works

Object.DateTimeField = DBNull.Value;

ofcourse the field should be able to accept null values...

-PK

"FatboyCanteen" <ze*******@fatboycanteen.com> wrote in message
news:06****************************@phx.gbl...
When I using dataset to append
a null value to the datetime field.

It throw a error -> can not convert db.null to system.date

Can there is any standard to pass a Null value
to the DateTime Field!
(It is successful to pass the Null Value to other type of
Field)

Nov 17 '05 #5

P: n/a
Can you explain more detail about insert null value
Because I don't understand --
object.DateTimeField

Thank YOu
-----Original Message-----
i use the following to insert NULL into datetime field and it works
Object.DateTimeField = DBNull.Value;

ofcourse the field should be able to accept null values...
-PK

"FatboyCanteen" <ze*******@fatboycanteen.com> wrote in messagenews:06****************************@phx.gbl...
When I using dataset to append
a null value to the datetime field.

It throw a error -> can not convert db.null to system.date
Can there is any standard to pass a Null value
to the DateTime Field!
(It is successful to pass the Null Value to other type of Field)

.

Nov 17 '05 #6

P: n/a
if ur using NullDate as the field containing the value to insert into the
DateTime field then
do
NullDate = DBNull.Value;

-PK

"FatboyCanteen" <ze*******@fatboycanteen.com> wrote in message
news:08****************************@phx.gbl...
Can you explain more detail about insert null value
Because I don't understand --
object.DateTimeField

Thank YOu
-----Original Message-----
i use the following to insert NULL into datetime field

and it works

Object.DateTimeField = DBNull.Value;

ofcourse the field should be able to accept null

values...

-PK

"FatboyCanteen" <ze*******@fatboycanteen.com> wrote in

message
news:06****************************@phx.gbl...
When I using dataset to append
a null value to the datetime field.

It throw a error -> can not convert db.null to system.date
Can there is any standard to pass a Null value
to the DateTime Field!
(It is successful to pass the Null Value to other type of Field)

.

Nov 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.