这是我的表在数据库:如何显示数据库中的图像在asp:与linq图像?
而且我读的数据库,如:
DataClassesDataContext db = new DataClassesDataContext();
usertable thisuser = db.usertables.First(p => p.username == User.Identity.Name);
所以,thisuser.picture
是手柄的形象。但是我怎样才能在我的页面上显示asp:image控件?
编辑 我将图片保存,此代码:
DataClassesDataContext db = new DataClassesDataContext();
usertable thisuser = db.usertables.First(p => p.username == User.Identity.Name);
byte[] filebyte = FileUpload1.FileBytes;
System.Data.Linq.Binary fileBinary = new System.Data.Linq.Binary(filebyte);
thisuser.picture = fileBinary;
db.SubmitChanges();
是有什么错吗?
您正在使用哪种格式的图片的感谢?另外,'image'在SQL Server中是不推荐使用的类型 - 您可能想使用'varbinary'代替。 –
通常为图片的格式是'jpg' – hamed
我不得不说这是一个完美的人:你尝试过什么?说真的,如果你给我们看,这个帖子会受益匪浅。 – ChiefTwoPencils