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.SqlClient;namespace test
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{


private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
int id=Convert.ToInt32(Request.QueryString["id"]);
string html="",memo="";
SqlConnection Conn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]);
try
{
Conn.Open(); 
SqlCommand Cmd = new SqlCommand( "select subject,memo from changnews where id="+id+" order by id desc", Conn );
SqlDataReader dr = Cmd.ExecuteReader();
//判断是否显示记录
if ( dr.Read() )
{
memo=dr["memo"].ToString();
memo=memo.Replace("  ","&nbsp;");
html+="<table width=560 border=0 align=center cellpadding=0 cellspacing=0>";
html+="<tr>";
html+="<td height=22 align=center class=bt>";
html+="<strong><font color=#CC0000>"+dr["subject"].ToString()+"</font></strong>";
html+="</td>";
html+="</tr>";
html+="<tr><td height=10></td></tr>";
html+="<tr><td height=22 class='li'>"+memo+"</td></tr>";
html+="<tr><td height=10></td></tr>";
html+="</table>";
}
divShow.Text=html;
}
catch(Exception ex)
{
}
finally
{
dr.Close();
Conn.Close();
}
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{    

this.Load += new System.EventHandler(this.Page_Load); }
#endregion }
}