Image field in the display database

xiaoxiao2021-03-06  40

using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls Using system.Web.ui.htmlcontrols;

Namespace WebApplication.ctrls {///

/// showindeximg's summary description. /// public class showlistimg: system.Web.ui.page {private string fid = ""; private void page_load (object sender, system.eventargs e) {// Place user code here to initialize the page FID = this.Request [ "ID"]; System.Data.SqlClient.SqlConnection BooksConn = new System.Data.SqlClient.SqlConnection (System.Configuration.ConfigurationSettings.AppSettings [ "SQLLinkString"]); BooksConn.Open (); string CMD = "select IMGType, IndexIMG from Web_SubWebInfo where ID =" FID; System.Data.SqlClient.SqlCommand myCMD = new System.Data.SqlClient.SqlCommand (); MyCMD.Connection = BooksConn; MyCMD.CommandText = CMD; System. Data.sqlclient.sqldataReader Reader = mycmd.executeRead (); Reader.Read (); this.response.contentType = (String) Reader ["IMGTYPE"]). Trim (); this.Response.binaryWrite (Byte [ ]) Reader ["Indeximg"]); this.Response.end (); reader.close (); mycmd.dispose (); booksconn.close ();}

转载请注明原文地址:https://www.9cbs.com/read-71317.html

New Post(0)