0
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=PROMOD-PC;Initial Catalog=travel_Directions;Integrated Security=True";
DataTable dt = new DataTable();
String selQuery = "SELECT Image FROM MapDataImage WHERE Source='" + TextBox1.Text + "';";
SqlCommand SelCmmnd = new SqlCommand(selQuery);
SqlDataAdapter sDatAdp = new SqlDataAdapter();
SelCmmnd.CommandType = CommandType.Text;
SelCmmnd.Connection = con;
con.Open();
sDatAdp.SelectCommand = SelCmmnd;
sDatAdp.Fill(dt);
ListView1.DataSource = dt;
ListView1.DataBind();
con.Close();
sDatAdp.Dispose();
con.Dispose();
dt.Dispose();
傢伙現在代碼已準備好...(執行沒有錯誤),但是當我點擊按鈕...它將顯示標籤像圖像: System.Byte [] ....在列表視圖 是否在代碼中有任何問題?我做了一個從數據庫檢索圖像的代碼?它工作,但它顯示,圖像:System.Byte []標籤
這段代碼錯了嗎? 有人請幫幫我嗎?找出這個............
你需要添加一個通用的處理程序來呈現實際圖像 - 看到這個答案(複製)http://stackoverflow.com/questions/21877/dynamically-rendering-aspimage-from-blob-entry-in-asp-淨 – Darren