Danh mục

ASP.NET 4 Unleased - p 47

Số trang: 10      Loại file: pdf      Dung lượng: 666.06 KB      Lượt xem: 11      Lượt tải: 0    
Hoai.2512

Hỗ trợ phí lưu trữ khi tải xuống: 1,000 VND Tải xuống file đầy đủ (10 trang) 0

Báo xấu

Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Using the SqlDataSource ControlLISTING 9.29 DynamicImage.ashxusing using using using usingSystem.Data; System.Web; System.Web.Configuration; System.Web.UI; System.Web.UI.WebControls;/// /// Displays an image corresponding to the Id passed /// in a query string field /// public class DynamicImage : IHttpHandler { public void ProcessRequest (HttpContext context) { // Get the Id of the image to display string imageId = context.Request.QueryString[“Id”]; // Use SqlDataSource to grab image bytes SqlDataSource src = new SqlDataSource(); src.ConnectionString = WebConfigurationManager.ConnectionStrings[“Images”].ConnectionString; src.SelectCommand = “SELECT Image FROM Images WHERE Id=” + imageId; // Return a DataView DataView view = (DataView)src.Select(DataSourceSelectArguments.Empty); context.Response.BinaryWrite( (byte[])view[0][“Image”]); // Return a DataReader...
Nội dung trích xuất từ tài liệu:
ASP.NET 4 Unleased - p 47

Tài liệu được xem nhiều: