?? webform1.aspx.cs
字號:
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;
using System.Data.OracleClient;
namespace WebImage
{
/// <summary>
/// WebForm1 的摘要說明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
OracleConnection mConn;
try
{
string sConn="data source=surprise;user id=jinqi;password=8626798;Max Pool Size=75;Min Pool Size=1";
string mSql="select sphoto from student where DBMS_LOB.getlength(sphoto)>0 and STUDENTID=1";
OracleDataReader m_Read = null;
mConn=new OracleConnection(sConn);
mConn.Open();
OracleCommand mCmd=new OracleCommand();
mCmd.Connection=mConn;
mCmd.CommandText=mSql;
m_Read=mCmd.ExecuteReader();
m_Read.Read();
byte[] mBlob=(byte[])m_Read["sphoto"];
Response.ContentType = "image/jpg";
Response.BinaryWrite(mBlob);
Response.End();
}
catch(Exception ex)
{
throw ex;
}
finally
{
mConn.Close();
}
}
#region Web 窗體設(shè)計器生成的代碼
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 該調(diào)用是 ASP.NET Web 窗體設(shè)計器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -