Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
5
Reply
Response.BinaryWrite error by LINQ
nothing else
Mar 2 2013 12:20 PM
1.9k
Reply
I have used the ADO.NET which i don't want to use to save Image to Database, but when i use LINQ to save image, i'm get error.
here is my DB:
ImageHandler.ashx
public class ImageHandler : IHttpHandler {
ImageDataDataContext image = new ImageDataDataContext();
public void ProcessRequest (HttpContext context) {
string imageid = context.Request.QueryString["ImID"];
var ketqua = (from img in image.tblImgs
where img.imgID == int.Parse(imageid)
select new
{
img.imgData
}).First();
context.Response.BinaryWrite((byte[])ketqua); //
Cannot convert type 'AnonymousType#1' to 'byte[]'
context.Response.End();
}
public bool IsReusable {
get {
return false;
}
}
}
Can you pls help me how to correct the error. thanks :)
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
Need to get the Row Count after execute a Stored Prodcedure
FirstOrDefault operator in LINQ