Page 1 of 1
Data source - datetime(nullable)
Posted: Tue Oct 02, 2012 1:40 pm
by pvasek
Hi All,
what do I need to do to add data source which will have column set to datetime(nullable)?
I tried to set AllowDbNull = true for the column but that didn't work.
Any ideas? Thank you!
Pavel
Re: Data source - datetime(nullable)
Posted: Wed Oct 03, 2012 7:59 am
by HighAley
Hello.
What Data Source do you use?
Where do you set the AllowDbNull property?
Could you provide any details else to reproduce the issue.
Thank you.
Re: Data source - datetime(nullable)
Posted: Thu Oct 04, 2012 2:34 pm
by pvasek
Hi Aleksey,
I am using method RegData of StiReport and passing System.Data.DataTable.
something like this:
Code: Select all
var report = new StiReport();
report.Load("myreport.mrt");
var data = new DataTable();
data.Columns("Date", typeof(DateTime)).AllowDbNulls = true;
data.Rows.Add(new DateTime(2003, 10, 25));
data.Rows.Add(DBNull.Value);
report.RegData(data);
The problem is on the second added row where the value is null and the report fails to render with message :
Expression in Text property of 'TableNumberOfEntriesByNoc_Cell12' can't be evaluated! Object reference not set to an instance of an object.
If I change the type for the given column in the report designer to datetime(nullable) it works fine. But I need to set it from code. I thought that setting AllowDbNulls will make the effect but it doesn't.
Thanks for your help!
Pavel
Re: Data source - datetime(nullable)
Posted: Mon Oct 08, 2012 9:44 am
by Alex K.
Hello,
DataSet does not support System.Nullable<>.
In this case, you can set the DateTime(Nullable) type of column in dictionary in designer.
Thank you.
Re: Data source - datetime(nullable)
Posted: Wed Oct 23, 2019 7:38 am
by zalak
Hello,
Any updates on this one
Alex K. wrote: ↑Mon Oct 08, 2012 9:44 am
Hello,
DataSet does not support System.Nullable<>.
In this case, you can set the DateTime(Nullable) type of column in dictionary in designer.
Thank you.
We are facing the same issue.
We need the column to have datetime(nullable) which should be set from the code and not in the designer. We are using the same method mentioned above by 'pvasek' to get datasource for the report.
We are using version 2019.1.1.0.
Thanks & Regards,
Zalak
Re: Data source - datetime(nullable)
Posted: Mon Oct 28, 2019 9:02 am
by Lech Kulikowski
Hello,
Please try to set the following option:
StiOptions.Dictionary.UseAllowDBNullProperty = true;
Thank you.