All pastes #163151 Raw Edit

Untitled

public text v1 · immutable
·published 2006-09-07 07:09 UTC
rendered paste body
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        SqlCommand objCommand = new SqlCommand();
        objCommand.CommandText = "SELECT PostID.Name FROM Post";
        objCommand.Connection = conn;
        SqlDataReader objReader = objCommand.ExecuteReader();
        while (objReader.Read())
        {
            Response.Write("<a href=page2.aspx?PostID="
                + objReader["PostID"].ToString() + ">"
                + objReader["Name"].ToString() + "</a>");
        }
    }
}