using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
using System.Data.SqlClient;
public partial class WebMain_news_daybimai : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand titsmd;
        SqlDataReader titsdr;
        TableRow tr;
        TableCell tc;
        HyperLink h1;
        Image img;
        titsmd = new SqlCommand("select top 10 *  from news where biglbid=10012 and isfp='y' order by adddate", conn);
        titsdr = titsmd.ExecuteReader();
        while (titsdr.Read())
        {     
            tr = new TableRow();
            tc = new TableCell();
            h1 = new HyperLink();
            img = new Image();
            img.ImageUrl = "~/images/pic/"+titsdr["picsmall"].ToString();
            tc.Controls.Add(img);
            tr.Controls.Add(tc);
            tc = new TableCell();
            h1.Text = titsdr["title"].ToString();
            if (titsdr["ischange"].ToString() == "y")
            {
                h1.NavigateUrl = titsdr["changeurl"].ToString();
                h1.Target = "_blank";
            }
            else
            {
                h1.NavigateUrl = "~/china/newscenter.aspx?id="+titsdr["id"].ToString();
                h1.Target = "_blank";
            }
            tc.Controls.Add(h1);

            tr.Controls.Add(tc);
            tc.Height = 20;
            Table1.Controls.Add(tr);
        }
        titsdr.Close();
        conn.Close();
    }
}
