This is a migrated thread and some comments may be shown as answers.

Materialize nullable DateTime field does not work

1 Answer 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Markus
Top achievements
Rank 1
Markus asked on 10 Feb 2017, 11:44 AM

Hi,

I have a class 'Equipment' with nullable datetime field 'PurchaseDate'. When execute sql query and materialize to non-persistent type, datetime field is always null. When I change data type to DateTime it works, but null values in database are mapped to DateTime.MinValue in object. Which causes problems when showing in RadGridView and GridViewDateTimeColumn.

DataAccess Version: 2016.2.822.1

 

string sqlSelect = "SELECT Name, Description, PurchaseDate FROM Equipment";
 
using (Telerik.OpenAccess.OpenAccessContext ctx = DbContext.DbContextFactory.Instance.GetNew())
{
    IList<ListModel.Equipment> list = ctx.ExecuteQuery<ListModel.Equipment>(sqlSelect);
    return list;
}

1 Answer, 1 is accepted

Sort by
0
Markus
Top achievements
Rank 1
answered on 10 Feb 2017, 04:06 PM
Please ignore my post there was an bug in my code. Misspelling and wrong Select-command
Tags
General Discussions
Asked by
Markus
Top achievements
Rank 1
Answers by
Markus
Top achievements
Rank 1
Share this question
or