想要在datalist中显示二进制图像,其中session [" name"]。tostring [英] want to display binary image in datalist where session["name"].tostring

查看:59
本文介绍了想要在datalist中显示二进制图像,其中session [" name"]。tostring的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hii

我想在datalist中使用where子句显示来自数据库的二进制图像..

试图显示会话所在的图像不想显示如果即时通讯使用id = @id,那么所有图像都显示为



我只想显示会话所在的二进制图像。 ..

.. plzzzz任何人都可以帮助我..

解决方案

在datalist的itemdatabound事件中,找到你的图像控件。如果你正在使用html标签设置src属性,如果你正在使用,请检查一下,可以帮助你:



  //  在数据列表的项目数据绑定事件中找到您的图像控件(Image1可以说)。 
// 在前端进行SQL查询并传递用户名(来自会话)以从DB获取图像
字节 [] myImage = GetMyImageFromMyDataSource();
字符串 st = Server.MapPath( myImageNameOrID.jpg); // 尝试使用名称+ ID使其唯一
FileStream fs = new FileStream(st,FileMode.Create,FileAccess.Write);
fs.Write(myImage, 0 ,myImage.Length);
fs.Close();
Image1.ImageUrl = myImageNameOrID.jpg;


hii
I want to display binary image from database in datalist with where clause..
trying to display image of that who's session is on dont want to display the all images of database in where clause if i m using where id=@id so all the images are showing

I just want to display a binary image who's session is on...
.. plzzzz any one can help me ..

解决方案

On the itemdatabound event of the datalist, find your image control. if you're using the html tag set the src property, if you are using , check this out,may help you:

//Find your image control (Image1 lets say) on the item databound event of the datalist.
//Make SQL query at front end and pass the name of the user(from session) to get image from DB
Byte[] myImage = GetMyImageFromMyDataSource();
String st = Server.MapPath("myImageNameOrID.jpg"); // Try Name + ID to make it unique
FileStream fs = new FileStream(st, FileMode.Create, FileAccess.Write);
fs.Write(myImage, 0, myImage.Length);
fs.Close();
Image1.ImageUrl = "myImageNameOrID.jpg"; 


这篇关于想要在datalist中显示二进制图像,其中session [" name"]。tostring的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆