I have a table in my database and one of its columns is in Image data type. I can store Image in database but I can't retrieve it. I want to retrive Image for each logged in user. I used this code:
public ActionResult ShowImage()
{
var userID = GetUserID();
var advert = from ad in StoreDb.Ads where ad.UserId == userID select ad.AdImage;
return File(advert, "Image");
}
But got this error:
Error 2 Argument 1: cannot convert from 'System.Linq.IQueryable' to 'string' C:\Users\Tena\Documents\Visual Studio 2010\Projects\MvcApplication6\MvcApplication6\Controllers\Default3Controller.cs 92 25 MvcApplication6
The problem is that advert is in
System.Linq.IQueryable<>byte[]
format but File needs byte[] format. What should I do now? Any answer is helpful.
Thanks