CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2009
    Posts
    177

    Cannot implicitly convert System.Linq.IQuerayable to xxx

    Hi,

    I had the following codes:

    Code:
      [ResponseType(typeof(cvwSMSInbox))]
            public IHttpActionResult GeteSMSInbox(string id, string search)
            {
                AESContext db = new AESContext(id);
    
                cvwSMSInbox record = new cvwSMSInbox();
    
                 record = db.cvwSMSInbox.Where(s => s.Branch_ID == search);
       
                return Ok(record);
            }
    I got the error below:

    Cannot implicitly convert type 'System.Linq.Iqueryable<cvwSMSInbox>' to 'cvwSMSInbox'. An explicit conversion exists.

    Any help is kindly appreciated.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Cannot implicitly convert System.Linq.IQuerayable to xxx

    Replace the .Where with .SingleOrDefault.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured