Hi everyone,

ALTER TABLE preventiveRecord
ADD Verifiedbymanager BIT NOT NULL
CONSTRAINT preventive_verify DEFAULT 0 WITH VALUES

ALTER TABLE preventiveRecord
ADD Verifiedbysupervisor BIT NOT NULL
CONSTRAINT preventive_verify DEFAULT 0 WITH VALUES

SELECT [ID]
,[Date_Done]
,[Date_Due]
,[SME]
,[Status]
,[History_ID]
,[Remark]
,[Verifiedbysupervisor]
,[Verifiedbymanager]
FROM [demo].[dbo].[preventiveRecord]

Here is my query :
from d in p.preventiveRecords.Where(d => d.Date_Done != null && p.preventiveRecords.Where( e =>e.VerifiedbySupervisor == null))

Please help me to how to return the value.

Recommended Answers

All 3 Replies

The lines after "Here is my query" don't make a well-formed SQL statement. It will help if you don't mix-and-match your languages.

Please post the surrounding code so we can have a context, then maybe we can help.

A description of what the "query" is supposed to do would also be nice.

Assuming this is LINQ:
It would probably be something like:

var lstOfRecords =
(
   from d in p.preventiveRecords.Where(d => d.Date_Done != null &&
   p.preventiveRecords.Where( e =>e.VerifiedbySupervisor == null))
   select new 
   {
      d.ID,
      d.Date_Done,
      d.Date_Due,
      d.SME,
      d.Status,
      d.History_ID,
      d.Remark,
      d.Verifiedbysupervisor,
      d.Verifiedbymanager
   } 
).ToList();

...but if you're trying to actually return this from a method, you will need to create a custom class to hold the values and return an instance of that class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.