LINQ to Entities does not recognize the method 'System.String ToString()'

Hi, i am working on MVC using LINQ query where i am heading a problem with LINQ Query. When I use following code 
public ActionResult GetProduct()
Category p = new Category();
var all = db.Products.ToList();
// var catname = from i in db.Categories select i.CategoryID.ToString();
p.CategName = (from i in db.Categories select new SelectListItem {Value =i.CategoryID.ToString(), Text = i.CategoryName }).ToList();
var qq = (from i in db.Products join j in db.Categories on i.CategoryID equals j.CategoryID select new Product { ProductName = i.ProductName, UnitPrice = i.UnitPrice, UnitsOnOrder = i.UnitsOnOrder }).ToList();
p.Products = qq;
return View("GetProduct", p);
It throws an error
LINQ to Entities does not recognize the method 'System.String ToString(Int32)' method, and this method cannot be translated into a store expression.
kindly help to fix this problem.
Mayank Mani Pandey India

Entity Framework cannot convert ToString() to SQL. Create the object after you have fetched the results:
public ActionResult GetProduct()
Category p = new Category();
var all = db.Products.ToList();
// var catname = from i in db.Categories select i.CategoryID.ToString();
p.CategName = (from i in db.Categories select i).AsEnumerable().Select(x => new SelectListItem { Value = x.CategoryID.ToString(), Text = x.CategoryName }).ToList();
var qq = (from i in db.Products join j in db.Categories on i.CategoryID equals j.CategoryID select new Product { ProductName = i.ProductName, UnitPrice = i.UnitPrice, UnitsOnOrder = i.UnitsOnOrder }).ToList();
p.Products = qq;
return View("GetProduct", p);
Please remember to close your threads by marking all helpful posts as answer and then start a new thread if you have a new question.

Similar Messages

  • Adobe Lightroom, Photoshop and Bridge does not recognize the raw files from my Canon Mark III 5D Camera.

    Adobe Lightroom, Photoshop and Bridge does not recognize the raw files from my new Canon Mark III 5D Camera.  How can I get my files open to view and edit?  I am using LR3, Photoshop CS3 and Bridge CS3.  Do I need to upgrade these programs or is there another way to get these programs to recognize my files?
    When I try opening the raw images in Lightroom, the thumbnails say "Preview unavailable for this file"  ... when I click "import" an error message pops up that says "The files are from a camera which is not recognized by the raw format support in Lightroom."
    When I try opening the raw images in Photoshop, an error message pops up saying "could not complete your request because photoshop does not recognize this type of file."
    When I try opening the raw images in Bridge, it just shows an icon with the file name and CR2.
    Please help!!!

    Unless I missed an announcement, today, LR6 isn't available, yet, right?  Only Adobe employees and beta testers would know what LR6 does differently at this point and they're all sworn to secrecy.
    LR5 is available as a standalone version.
    PS-CS6 is available as a serial-number-licensed version.
    PS-CC + LR5 are also available as a Photography Plan subscription for $10/month with a minimum OS versions of OSX 10.7 (and probably 10.8, soon) and Windows 7.
    Bridge is part of PS, not a separate program.
    LR5 standalone and LR+PS-CC plan are both available on this page:  http://www.adobe.com/products/catalog/software.html
    PS-CS6 can be found on this page:  Creative Suite 6 which can be found by searching www.adobe.com for Photoshop CS6 and clicking the Buy link in the on-the-fly search results.
    As with any new Adobe software, it might be wise to run it in trial mode for a few days/weeks to see if it works well with your computer, before purchasing and finding out you might need a new computer, first.

  • HT204135 I update my Mac to version 10.9.2 and now my printer does not work anymore. I did all the software updates and I do not understand why my mac does not recognize the printer anymore?

    I update my Mac to version 10.9.2 and now my printer does not work anymore. I did all the software updates and I do not understand why my mac does not recognize the printer anymore?

    Go to the website of the manufacturer of your printer and check to see if they have released an updated driver for your particular model.

  • HT4993 I updated to ios 7, put in a password but now it does not recognize the password and will not let me get into my phone.  what do i do?

    Yesterday I decided to finally update my iphone 4S to the latest operating system 7.  It asked me for a password when upgrading but now does not recognize the password and will not let me in.  FRUSTRATED.  What do i do????

    Hi Rachel,
    Welcome to the Support Communities!
    The article below may be able to help you with this.
    Click on the link to see more details and screenshots. 
    iOS: Forgotten passcode or device disabled after entering wrong passcode
    http://support.apple.com/kb/ht1212
    Cheers,
    - Judy

  • Is there another way to close apps other than deleting them from the multitask bar.....I have a small crack in the bottom of my screen and that part of the screen does not recognize the touch.  :(

    Is there another way to close apps other than deleting them from the multitask bar.....I have a small crack in the bottom of my screen and that part of the screen does not recognize the touch. 

    There's generally no reason to be closing them that way at all. The apps you see in the recents bar are just that, apps that you used recently. Most of them are doing absolutely nothing. The only apps that are really doing anything in the background are ones that play music and ones that are using location services. Just leave them be.
    Best of luck.

  • Untrusted server cert chain & does not recognize the certificate authority

    I have java code that makes an ssl connection to an HTTPS server.
    The code workes fine when I connect to a server that has a
    certificate that was issued by a recognizable authority.
    But when I try to connect to our test HTTPS server which has a
    certificate that was created by ourselves for debug, I get this
    java exception: "untrusted server cert chain".
    When I connect to our test HTTPS server with a browser, I get
    this message from the browser in a popup window:
    "www.xyz.com is a web site that uses a security certifcate to
    identify itself. However netscape 6 does not recognize the
    certificate authority that issued this certificate."
    At this point I am able to accept the certificate in the popup
    window and continue.
    Question: In my java code how can I accept a certificate
    that was signed by an unrecognizable authority just like the
    browser can. Or during debug, how can I set an override
    to accept ALL certs no matter what.
    Thanks.....Paul

    You will have to import your server test certificate into your client machine keystore. By default the keystore will be the 'cacerts' file in JAVA_HOME/jre/lib/security, get your server certificate in .pem format and use keytool to import it to the client.
    keytool -import -alias <anything> -file <full path of .pem file> -keystore <full path of cacerts file>
    The keystore password is 'changeit' by default, keytool comes with the JDK.
    The reasoning behind this is to prevent the misuse of test certificates, the client has to consciously import an untrusted certificate. When you install a real certificate on your server the client will be automatically validated if bought from a trusted CA (Thawte, Verisign).
    Take a look at the java.security.KeyStore class, you can use it to view your certificate chain.
    Ronny.

  • Ipod touch will not turn on and computer does not recognize the device

    I tried resetting my ipod touch, but there is still no response. I have had it plugged into the computer for a couple of days. I don't know if it is charging or what because the screen won't turn on and the computer does not recognize the device. I have downloaded the latest version of iTunes, as well as restarting my computer several times. Does anyone know what to do? I would try restoring it, but like I said my computer doesn't recognize it and itunes doesn't either. Thanks!

    I just had a similar problem and tried all of the reboot techniques with no success. I knew it had to be a connection issue inside the iPod, and grasping at straws, I sprayed a little WD-40. I dried it off and let it sit overnight. Today at lunch I plugged it in to my wall charger and it began charging.
    ***FYI I know they don't recommend spraying WD-40 on your iPod, but it was a last resort for me. I was at the point of paying to send it in for repairs or throwing it away. I wouldn't try this unless you are ready to throw yours away too.

  • I have an iphone 5s and it is synced to itunes and works fine. previously I have downloaded audiobooks to my wifes 6th gen nano using this account - now I tunes does not recognize the device and also it seems that it is not being read by the computer?

    I have an iphone 5s and it is synced to itunes and works fine. previously I have downloaded audiobooks to my wifes 6th gen nano using this account - now I tunes does not recognize the device and also it seems that it is not being read by the computer?

    Hey Stan1958,
    Thanks for the question. I understand you are experiencing issues with your iPod nano and iTunes. Based on your symptoms, you may find the following resources helpful in resolving this issue:
    Windows
    iPod appears in Windows but not in iTunes
    iPod not recognized in 'My Computer' and in iTunes for Windows
    iTunes reports that "iTunes cannot recognize this iPod at this time"
    Thanks,
    Matt M.

  • I recently moved and had to disconnect my WD My Pro Edition II 2TB external drive I had been using for backup.  Its been several months and now when i try to reconnect the external dire (Use a firewire cable) it does not recognize the drive is there.  I a

    I recently moved and had to disconnect my WD My Pro Edition II 2TB external drive I had been using for backup. 
    Its been several months (many upgrades to the iMac software during this time), and now when I try to reconnect the external dire (Use a firewire cable) it does not recognize the drive is there.  I also tried "reloading" software from the Western Digital site, but after following all the instructions, it looks like my iMac doesn't support this software (I can't even locate it after I follow all the instructions.
    Thnaks,  for anyones ideas on how I can get this working again.....

    First of all, you do not really want to use their software; if you want a bootable clone, use either Carbon Copy Cloner or SuperDuper. If you simply want to drag and drop some files, you don't need software to do that. The important thing on any external drive is that you format/partition it correctly (Mac OS Extended (Journaled) and using GUID partition scheme). 
    Unfortunately, I don't know anything about WD drives or their software, so I don't have any idea what kind of backup you did. Having said that, it should still recognize the external even if it's outdated. Have you tried mounting it manually in Disk Utility? If you can get it to mount, you could (worst case scenario) just drag your stuff off onto your internal and then reformat the external.

  • My iphone 5 is frozen on the screen that shows a cable and itunes symbol.  I can not get the phone to enter DFU mode and itunes does not recognize the phone when plugged in to itunes.  The phone was mid update when it was disrupted....

    I plugged my iphone in to do an update and it was mid way through the update when the phone was accidentally disconnected.  Now the phone is stuck on the screen that shows a cable and the iTunes image suggesting the phone needs to be plugged in to iTunes.  I have plugged it in, powered on and off, attempted to enter DFU mode numerous times all with no success.  ITunes does not recognize the phone and I continue to only receive the screen saying I need to plug in to iTunes..  Please help!

    Hold Sleep Button with Home Button toghether until it restarts Always it takes 8 to 15 seconds, after it restarts leave the sleep button and remember do not leave the home button it automaticlly switches to DFU mode.

  • When I try to click on a download link for a .pdf file Firefox does not recognize the MIME type and tries to download the file as "index.php"

    When visiting a site I frequent I tried to download a linked .pdf file. Previously I've used Firefox 7.0.1 to download the link with no problem. Using Firefox 8 however I the browser does not recognize the .pdf link's mime type. Instead of recognizing the download link as a .pdf file Firefox 8 tries to download it as "index.php". Firefox 8 does this with .doc files and .txt files as well. When I downgrade to 7.0.1 again the problem disappears.

    Hi hakmacpace,
    I'd try starting Firefox in [[Safe Mode]]. If you don't have the issue while all of your add-ons, extensions, and themes are disabled, you can try adding them back in one by one until you find the culprit. You should look at the [https://support.mozilla.org/en-US/kb/Troubleshooting-extensions-themes Extensions and Themes troubleshooting guide ] and the [[Troubleshooting plugins]] article as well.
    You could also try [https://support.mozilla.org/en-US/kb/Managing-profiles?s=create+a+new+profile&r=2&e=es&as=s#w_creating-a-profile Creating a new profile].
    Hopefully this helps!

  • Lightroom does not recognize the raw format of files loading from my Nikon AW1 and loads them as jpegs. I know there are updates that would allow this camera to be recognized as shooting raw but I haven't been able to work it out. Any help out there?

    Lightroom does not recognize the raw files (necs?) coming in from my Nikon AW1. It loads them as jpegs. I know it is possible to update Lightroom so it knows my Nikon but I can't get it to work.
    I would like files to be loaded as .dng.

    update by downloading the files directly and then applying them for lr 4 and earlier,  http://www.adobe.com/downloads/updates/
    for lr 5.7.1, the last lr 5 update, use the below link:
    Downloadable installation files available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4, CS4 Web Standard | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 | 12 | 11, 10 | 9, 8, 7 win | 8 mac | 7 mac
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7 win | 8 mac | 7 mac
    Lightroom:  6| 5.7.1| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5.5, 5 | 1
    Contribute:  CS5 | CS4, CS3 | 3,2
    FrameMaker:  12, 11, 10, 9, 8, 7.2
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • How can I get my iMac to reconize my LG Optimus 5 phone so I can transfer itunes. When I plug it in it does not recognize the phone

    I have an iMac that I want to transfer stored itunes to my Optimus LG 5 android phone. When I plug my phone into the computer the computer does not recognize the phone. What can I do to so I can then transfer my tunes?

    The screen is all black, so it's not the backlight. It's weird because when I get the computer off of sleep mode, it shows the log in screen really quickly. So my LCD isn't broken either. It just switches back to the wrong resolution I guess. Which makes the screen black again.

  • Acrobat 9 does not recognize the smart card reader that work with other app. Can someone help me?

    Hi to All,
    Acrobat 9 (included in CS4 design premium) does not recognize the smart card reader. I have a smart card reader ACR38 smart card that works with all applications except Acrobat 9 pro. I tried to uninstall and reinstall it again, but when I try to insert the digital signature message is always the same, that does not find the Acrobat reader. Can someone help me?

    Hi MartinR
    Thank you for your reply, i have tried what you suggest, and it did not work, the i DVD opening title changed but not the embedded movie.
    Perhaps it is a setting in Final Cut Express?
    After capturing my footage, i open a new project then i convert all clips to anamorphic, to give me the letterbox effect, i have tried now with and without anamorphic.
    In my canvas screen, the footage does not fill the square, even if i have not selected anamorphic, and fall well within the TV safe areas, but the only way to ill the canvas up is to crop it bigger, but still when i export it does not give me the full screen view.
    Any ideas?

  • Adobe Reader 10.1.3 does not recognize the windows vista installed printer

    I am using the latest version of Adobe Reader. When I print I get a message box that says you must install a printer driver. I have a printer installed in Windows Vista Home Premium that works ok with all other programs.  Any ideas?

    All updates applied to ver 10.1.10.  Same problem - does not recognize the network printer.  When I first installed this version and the Software License Agreement displayed it allowed me to access the printer dialog and print the form. When I open a pdf document after this it does not recognize that there isa printer installed.  Any ideas??? This is getting vdery frustating.  The only good news is that foxit works.

Maybe you are looking for

  • Updating equation in formula node from a string or text file

    Is it possible to have a calculation performed based on an equation stored in a string (read from a text file). I am guessing not because the equation would need be compiled but thought I would ask.

  • I am unable to upoad RAW photos to lightroom from my d600

    i am unable to upload my photos from my 600 to lightroom !! HELP !!!!

  • Application Clustering & JMS

    Hi All, I am in the process of moving an existing application to WebLogic 11g. This applications used to run on OC4J and we used multiple JVMs for the OC4J container to get some scalability. For WebLogic, we are considering a similar feature and arri

  • Certification Query:  SAP Certified Associate Enterprise Architect

    Hi Gurus I am planning to take "SAP Certified Associate Enterprise Architect" certification exams during this Teched. Kindly enlighten me the study materials, pre requsites, scope of certification, and any additional information on the same will be h

  • Why is JSTL included with Java WSDP?

    Just out of curiosity, why is JSTL bundled with JWDSP? The new JSTL is very slick technology (especially the new EL support), but I don't see any direct applications of JSTL to web services. Since most service implementations aren't Beans (e.g., the