1.建立一aspx页面,html代码2.cs代码
using System.Data.SqlClient;
using System.IO;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindData();
}
if (ID != "")
{
GetDescriptionByID(ID);
}
}
property#region property
private string ID
{
get
{
if (Request["ID"] != null && Request["ID"].ToString() != "")
{
return Request["ID"];
}
else
{
return "";
}
}
}
#endregion
GetDescriptionByID#region GetDescriptionByID
private void GetDescriptionByID(string ID)
{
string connStr = ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection conn = new SqlConnection(connStr);
string sql = "select * from testimage where userid=''" + ID + "''";
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
string s = @"<table cellspacing=''0'' cellpadding=''4'' width=''300'' height=''200'' border=''0'' id=''GridView1'' style=''color:#333333;border-collapse:collapse;''>";
if(dr.Read())
{
s += "<tr style=''color:#333333;background-color:#FFFBD6;''>";
s += "<td width=''50''>名称:</td>";
