Q:

ASP.NET: DataRow won't present content of database

I want to present the content of the rows of my database in my website.
this is my code:
public partial class Movies : System.Web.UI.Page
{
    private string ConString = "Data Source=MICROSOF-58B8A5\\SQL_SERVER_R2;Initial Catalog=Movie;Integrated Security=True";
    private SqlConnection Con ;
    private SqlCommand cmd ;
    private SqlDataAdapter adapter ;
    private string SqlQuery = "SELECT * FROM Movies";
    private DataTable dt;

    public DataTable DT
    {
        get { return dt ;}
        set { value = dt; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {

        if (Session["UserEnter"] != null)
        {
            UserNameOrGuest.Text = Session["UserEnter"].ToString();
        }
        //else
        //{
        //    Response.Redirect("Home.aspx");
        //}

        this.Con = new SqlConnection(ConString);
        this.Con.Open();
        this.cmd = new SqlCommand(SqlQuery, Con);
        this.adapter = new SqlDataAdapter(SqlQuery,Con);
        dt = new DataTable();
        adapter.Fill(dt);

    }

and this is My Webform :
  <%foreach (System.Data.DataRow dataRow in DT.Rows )
    {
        Label1.Text = DT.Rows[0]["Title"].ToString; 
    } %>

Why wont it present it properly ?
Thanks!

A:

You are already looping through all the rows in your page, but you are assigning the same value (title from the first movie) to the same label (Label1). 
Instead, using your foreach loop you would display the data for each row like this:
<% foreach (System.Data.DataRow dataRow in DT.Rows ) { %>
    <% = dataRow["Title"].ToString %>
    <br /> 
<% } %>

Notice that inside the loop you have access to each row individually. So just write out the value of the column(s) as you go.

