LINQ - Not Supported Exception was Unhandled

Asked By lavanya r
31-Aug-10 02:33 PM

Hi

I am trying to execute following Linq query 

var x = from d in obj.PG_PAYMENT_TRANSACTIONS

                        from a in obj.PG_CONTRACT_MASTER

                        where (d.CREATED_DATE.Date) == (DateTime.Now.Date) && d.CONTRACT_ABBR == a.CONTRACT

                        select new { d.TRANSACTION_ID };

                foreach (var item in x)

                {     Getting Error Here Saying that              

               }

The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.

Any Idea,
Lavanya

  Peter Bromberg replied to lavanya r
31-Aug-10 03:39 PM
Are you sure that d.CREATED_DATE.Date shoudn't be d.CREATED_DATE  ?
  lavanya r replied to Peter Bromberg
01-Sep-10 10:39 AM
Yes,

You are right, i am able to solve this by creating a  field before using in linq. Not sure why it is giving runtime exception using directly DateTime.Now.Date. 

static DateTime today = DateTime.Now.Date;
 var x = from a in obj.PG_PAYMENT_TRANSACTIONS
                        from b in obj.PG_CONTRACT_MASTER
                        where (a.CREATED_DATE) > today && a.CONTRACT_ABBR == b.CONTRACT
                        select new {  };

Thanks 
Lavanya
Create New Account
help
convert datetime error in asp.net hi friends, String was not recognized as a valid DateTime. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code Exception Details: System.FormatException: String was not recognized as a valid DateTime. Source Error: please give the solution. thanks. Line 88: public void fillgrid() Line 89: { Line 90: DateTime
Hi, using the psi to populate tasks in a projectdataset sometime ends with the attached error msg. The error occurs very snatchy : Fehlerzusammenfassung / Bereiche: GeneralQueueException GeneralQueueException Queue GeneralQueueJobFailed Fehlerdetails: uid = "a8228921-3a68-4ba2-9726-e7cc61f95bdb" messageID = "2" exception = "System.Data.SqlClient.SqlException: Bei der Konvertierung eines char-Datentyps in einen datetime-Datentyp liegt der datetime-Wert außerhalb des gültigen Bereichs. Bei der Konvertierung eines char-Datentyps in einen datetime-Datentyp liegt der datetime-Wert außerhalb des gültigen Bereichs. Bei der Konvertierung eines char-Datentyps in einen datetime-Datentyp liegt der datetime-Wert außerhalb des gültigen Bereichs. Bei der Konvertierung eines char-Datentyps
Exception while creating new library SharePoint Hi I get this strange error: "Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))" when running following code. Exception raises after 1 or two libraries were already created, so i really don't know what is tha issue foreach (XmlNode nod in rows) { / * Get Current date * / DateTime date = DateTime.Parse(nod.Attributes["ows_" + Settings.Default.DateCreatedColumn].Value); / * Get Folder * / string libraryName = date.Year.ToString Process. I think you'll find what's wrong. It's difficult to find the error just looking your code ! Laurent Cotton www.bewise.fr keywords: Exception, while, creating, new, library
how to create Exception Error Log or Error File For Website hi friends, how to create Exception Error Log or Error File For Website Thanks tvn you can create one error.aspx file which shows related errors. . and put your code in between try catch block and in the catch part you can redirected to that error.aspx page Follow this- Step 1: Start by creating an Error folder where all errors
incorrect syntax i have codings for send mail to password: it show error kindly clear my error and give it to me: Error 12 ) expected Error 13 ; expected Error 14 Invalid expression term ', ' Error 15 ; expected Error 16 ; expected Error 17 Invalid expression term ')' Error 18 ) expected Error 19 ; expected Error 20 Invalid expression term