error occurred during retrieve image from database use Linq query
<p>following code i used to retrieve Image from database through linq query
but i getting error like </p>

<p><strong>LINQ to Entities does not recognize the method 'System.String ToString(System.String)' method, and this method cannot be translated into a store expression.</strong></p>

<p>Error line coded with //error occurred.</p>

<pre><code>public void ProcessRequest (HttpContext context) {

        HttpRequest req = context.Request;


        MembershipUser user_id1 = Membership.GetUser();
        string user_id = user_id1.ProviderUserKey.ToString();      

        // string categoryID =Convert.ToInt32("4");// req.QueryString["CategoryID"].ToString();
        // Get information about the specified category          
        TMSEntities db = new TMSEntities();
        //get User ID From Login


        var category = (from data in db.Register1_db
                       where data.User_ID == Convert.ToString(user_id)
                       select data.Student_Photo);

        //error occurred.
        int len = category.First().Length;

        // Output the binary data          
        // But first we need to strip out the OLE header          
        int OleHeaderLength = 78;
        int strippedImageLength = len - OleHeaderLength;
        byte[] imagdata = new byte[strippedImageLength];          
        Array.Copy(category.First().ToArray(), OleHeaderLength, imagdata, 0, strippedImageLength);          
        if ((imagdata) != null)          
        {              
            MemoryStream m = new MemoryStream(imagdata);              
            System.Drawing.Image image = System.Drawing.Image.FromStream(m);              
            image.Save(context.Response.OutputStream, ImageFormat.Jpeg);          
        }




}




public bool IsReusable {
    get {
        return false;
    }
}
</code></pre>
