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_Product_leftproduct_leftmune : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand smd2 = new SqlCommand("select top 12 * from ProductInfo where IsNew='y' and ISPublished='y' order by AddDate", conn);
        SqlDataReader sdr2 = smd2.ExecuteReader();
        TableRow tr;
        TableCell tc;
        HyperLink h1;
        Image img;
        while (sdr2.Read())
        {
            tr = new TableRow();
            tc = new TableCell();
            h1 = new HyperLink();
            h1.NavigateUrl = "~/china/productlist.aspx?id=" + Convert.ToString(sdr2.GetInt32(0)).Trim();
            h1.Text = SubStr(sdr2.GetString(3) + "  " + sdr2["Description"].ToString(), 13);
            h1.CssClass = "fontleft_01";
            tc.Controls.Add(h1);
            tc.HorizontalAlign = HorizontalAlign.Left;
            tr.Controls.Add(tc);
            TB.Controls.Add(tr);
        }
        sdr2.Close();
        conn.Close();
    }
    public string SubStr(string sString, int nLeng)
    {
        if (sString.Length <= nLeng)
        {
            return sString;
        }
        string sNewStr = sString.Substring(0, nLeng);
        string sy = "...";
        sNewStr = sNewStr + sy;
        return sNewStr;
    }
}
