こんにちは私はieを含むpProductImageを取得しようとしています。製品テーブルの〜/ Images / pic1.jpg(images url)を使用し、pProductIdを識別子として使用して、IDに応じてさまざまな画像を表示します。
これは私のcataglogue.aspx.csです
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.OleDb;
public partial class Catalogue : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string ImageId = Request.QueryString["Img"];
string sqlText = "SELECT pProductImage FROM Products WHERE pProductId = " +ImageId;
OleDbConnection mDB = new OleDbConnection(ConfigurationManager.ConnectionStrings["AccessConnection"].ConnectionString);
OleDbCommand cmd = new OleDbCommand(sqlText, mDB);
mDB.Open();
OleDbDataReader rdr = cmd.ExecuteReader();
if (rdr.Read())
{
Response.BinaryWrite((byte[])rdr["pProductImage"]);
}
mDB.Close();
}
}
そして私のcataglogue.aspx(画像コントロールに表示する画像)
<div>
<img src="Catalogue.aspx?pProductId=2" alt="" />
</div>