check datetime field null value or blank value

Stimulsoft Reports.NET discussion
Post Reply
Vikas
Posts: 20
Joined: Sat Jul 31, 2010 4:12 am
Location: Delhi

check datetime field null value or blank value

Post by Vikas »

Hi

FinalDuration field datatype is datetime in access database. In table few rows are blank without data. I am using the below formula to calculate the field value.

Hour(DownloadTourMaster.FinalDuration) * 3600 + Minute(DownloadTourMaster.FinalDuration) * 60+ Second(DownloadTourMaster.FinalDuration)

but in database table few rows are blank without data. so its displaying the runtime error
Null referenece as Object reference not set to an instance of an object.

So I need to write a check condition so that if field is blank , its not calculate the field value.

Please help me.

Thanks
Vikas
Attachments
558.SampleList.mrt
(76.29 KiB) Downloaded 371 times
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

check datetime field null value or blank value

Post by Ivan »

Hello,

Can you please send us a sample report with data, which reproduces the issue?

Thank you.
Vikas
Posts: 20
Joined: Sat Jul 31, 2010 4:12 am
Location: Delhi

check datetime field null value or blank value

Post by Vikas »

Hi Ivan

Issue is that if in database table are missing few records in finalduration column then runtime error is coming.

I want to check that if row does bot have the data in particular row , in that case its not show thw error. So i need to implement a IF condition.

Please see the attachment throuigh my first post.

Please suggest

Thanks
Vikas
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

check datetime field null value or blank value

Post by Alex K. »

Hello,

Use the following code:
Hour(DownloadTourMaster.FinalDuration.GetValueOrDefault()) * 3600 + Minute(DownloadTourMaster.FinalDuration.GetValueOrDefault()) * 60+ Second(DownloadTourMaster.FinalDuration.GetValueOrDefault())
Thank you.
Post Reply