从SQL Server数据库中获取图像URL以显示图像

时间:2021-05-28 21:21:37

I have a column in my database that stores the url of the user's profile picture. In the home page' page_load event handler, I need to determine the image url, but I don't know how to do that using SQL commands.

我的数据库中有一列存储用户个人资料图片的网址。在主页'page_load事件处理程序中,我需要确定图像URL,但我不知道如何使用SQL命令。

From the images below, how can I give the query result to the image's ImageUrl property?

从下面的图像中,如何将查询结果提供给图像的ImageUrl属性?

从SQL Server数据库中获取图像URL以显示图像

从SQL Server数据库中获取图像URL以显示图像

1 个解决方案

#1


1  

You can use Server.mappath("~/profilepicture/profilepicture.jpg")

您可以使用Server.mappath(“〜/ profilepicture / profilepicture.jpg”)

OdbcDataReader reader=new OdbcDataReader();
reader=command.executereader;
    Profilephotobutton.imageur=server.mappath(" & reader.item(profilepicture) & ");

hope this helps

希望这可以帮助

#1


1  

You can use Server.mappath("~/profilepicture/profilepicture.jpg")

您可以使用Server.mappath(“〜/ profilepicture / profilepicture.jpg”)

OdbcDataReader reader=new OdbcDataReader();
reader=command.executereader;
    Profilephotobutton.imageur=server.mappath(" & reader.item(profilepicture) & ");

hope this helps

希望这可以帮助