void init() { DataTable dt = nb.NewsSelect("SELECT title,title_eng,msg,msg_eng,link,link_eng FROM [tab_news] WHERE left(discription,4) = '福利计划'"); this.DropDownList1.Items.Clear(); foreach (DataRow dr in dt.Rows) { if (Session["language"] != null && Session["language"].ToString() == "en-us") { this.DropDownList1.Items.Add(dr["title_eng"].ToString()); } else { this.DropDownList1.Items.Add(dr["title"].ToString()); } } if (dt.Rows.Count > 0) { if (Session["language"] != null && Session["language"].ToString() == "en-us") { content1.Value = dt.Rows[0]["msg_eng"].ToString(); this.TextBox2.Text = dt.Rows[0]["link_eng"].ToString(); } else { content1.Value = dt.Rows[0]["msg"].ToString(); this.TextBox2.Text = dt.Rows[0]["link"].ToString(); } } }
void init() { Bll.newsBll nb = new Bll.newsBll(); string s; if (Session["language"] != null && Session["language"].ToString() == "en-us") { s = "select title_eng as title, msg_eng as msg,link_eng as link,time from tab_news where discription=N'福利计划" + Session["Company"] + "'"; } else { s = "select * from tab_news where discription=N'福利计划" + Session["Company"] + "'"; } DataTable dt = nb.NewsSelect(s); this.Label1.Text = DateTime.Parse(dt.Rows[0]["time"].ToString()).ToShortDateString(); this.HyperLink1.NavigateUrl = this.HyperLink2.NavigateUrl += dt.Rows[0]["link"].ToString(); this.HyperLink1.Text = dt.Rows[0]["title"].ToString(); content = dt.Rows[0]["msg"].ToString(); }