使用ASP.NET从SQL Server显示图像

时间:2018-05-05 17:48:14

标签: asp.net sql-server

$cars = array("Volvo", "BMW", "Toyota", "BMW", "Toyota");

2 个答案:

答案 0 :(得分:0)

在审核您的评论和代码后,您可以使用以下代码

 <asp:Image ID="img1" runat="server" ImageUrl =<%# string.Format("~/image/{0}",Eval("Photo"))%>
  

答案 1 :(得分:0)

protected void ddlitemname_TextChanged(object sender,EventArgs e) {     DataSet ds = Common.ExecuteQuery(&#34; select * from Tbl_Item_Master,Category =&#39;&#34; + ddlitemname.SelectedItem.Text +&#34;&#39;&#34;);

if (ds.Tables[0].Rows.Count > 0)
{
    txthscode.Text = ds.Tables[0].Rows[0]["Hscode"].ToString();
    txtselect.Text = ds.Tables[0].Rows[0]["specification"].ToString();
    txttax.Text = ds.Tables[0].Rows[0]["Tax"].ToString();
    img1.ImageUrl = "~/Image/" + ds.Tables[0].Rows[0]["Photo"].ToString();
}

}