DateTime => Date

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 22-Mar-2009 15:53:28   

Hi,

With the following code for SQL Server 2005...


            EntityCollection<VwDaysSinceDepositEntity> collection = new EntityCollection<VwDaysSinceDepositEntity>();

            DataAccessAdapter adapter = new DataAccessAdapter();

            RelationPredicateBucket bucket = new RelationPredicateBucket();
            bucket.PredicateExpression.Add(VwDaysSinceDepositFields.DaysSinceDeposit == daysRemaining);
            bucket.PredicateExpression.Add(VwDaysSinceDepositFields.LastEmailDate < DateTime.Today);

            adapter.FetchEntityCollection(collection, bucket);

How can I use only the date part of 'LastEmailDate' in the comparison 'VwDaysSinceDepositFields.LastEmailDate < DateTime.Today'?

Cheers, Ian.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 22-Mar-2009 18:28:36   

If you want to execlude the time part on the database, you may use a DBFunctionCall to call for the SQL Server Function DATEPART() to use the DATE part only.

David Elizondo | LLBLGen Support Team