// Savienojums ar datu bāzi. readonly string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; public void ProcessRequest(HttpContext context) { NpgsqlConnection con = new NpgsqlConnection(CS); if (!string.IsNullOrWhiteSpace(context.Request.QueryString["image_id"])) { string img_id = context.Request.QueryString["image_id"].ToString(); con.Open(); string sTSQL = "select image from images where image_id=@image_id"; NpgsqlCommand cmd = new NpgsqlCommand(sTSQL, con); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@image_id", img_id.ToString()); object data = cmd.ExecuteScalar(); con.Close(); cmd.Dispose(); context.Response.BinaryWrite((byte[])data); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)