public void Bind4() { string sql = "select top 5 * from [Plan] where username='******' order by planid desc"; this.DataList4.DataSource = OperateDB.ExecuteDataSet(sql); this.DataList4.DataBind(); }
public void Bind3() { string sql = "select top 5 * from News order by NewsID desc"; DataList3.DataSource = OperateDB.ExecuteDataSet(sql); DataList3.DataBind(); }
public string getname() { string sql = "select Name from Employee where username='******'"; string Name = OperateDB.getExecuteScalar(sql); return(Name); }
private void bind2() { string Name = SelectName(); string sql = "select top 5 title,sid,Pubdate from Email where Meetname='" + Name + "' order by sid desc "; this.DataList2.DataSource = OperateDB.ExecuteDataSet(sql); this.DataList2.DataBind(); }
private static string getemailnum(string Name) { string sql1 = string.Format(@"SELECT COUNT(*) AS Expr1 FROM Email WHERE (Meetname = '{0}') AND (Status = '未读')", Name); string s = OperateDB.getExecuteScalar(sql1); return(s); }
private void bing1() { string UserName = Session["UserName"].ToString(); string sql = "select id from UserInfo where UserName='******'"; int id = Convert.ToInt32(OperateDB.getExecuteScalar(sql)); string sql1 = "select top 5 * from Calendar where id=" + id + " order by CalendarID desc"; DataSet ds = OperateDB.ExecuteDataSet(sql1); this.DataList1.DataSource = ds.Tables[0]; this.DataList1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string num = getemailnum(getname()); if (num != "0") { this.emailcount.InnerText = num; this.title.InnerHtml = "You have " + num + " Mails"; string sql = "select * from Email where Meetname='" + getname() + "' and Status = '未读'"; this.dl.DataSource = OperateDB.ExecuteDataSet(sql); dl.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!OA.Administrator.admin.isadmin(Session["UserName"].ToString())) { Response.Write("<script>alert('你没有权限');window.opener=null;window.close();</script>"); } else { string num = getemailnum(getname()); if (num != "0") { this.emailcount.InnerText = num; this.title.InnerHtml = "You have " + num + " Mails"; string sql = "select * from Email where Meetname='" + getname() + "' and Status = '未读'"; this.dl.DataSource = OperateDB.ExecuteDataSet(sql); dl.DataBind(); } } }
public static PagedDataSource paged(string sql, AspNetPager AspNetPager1) { DataSet ds = OperateDB.ExecuteDataSet(sql); DataTable dt = new DataTable(); dt = ds.Tables[0]; DataColumn dc = dt.Columns.Add("number", System.Type.GetType("System.String")); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["number"] = (i + 1).ToString(); } DataView dv = ds.Tables[0].DefaultView; PagedDataSource pds = new PagedDataSource(); AspNetPager1.RecordCount = dv.Count; pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; return(pds); }
public string getRemark() { string html = ""; string sql1 = "select top 5 * from NewsRemark where NewID in (select newsid from News where UserID=(select Employeeid from Employee where username='******')) order by Pubdate desc"; SqlConnection con1 = new SqlConnection(ConfigurationManager.AppSettings["Connection"]); con1.Open(); SqlCommand com1 = new SqlCommand(sql1, con1); SqlDataReader dr1 = com1.ExecuteReader(); List <remark> remarklist = new List <remark>(); while (dr1.Read()) { remark re = new remark(); string sql = "select username from Employee where Employeeid=" + dr1["UserID"]; re.username = OperateDB.getExecuteScalar(sql); sql = "select title from News where NewsID=" + dr1["NewID"]; re.title = OperateDB.getExecuteScalar(sql); re.content = dr1["content"].ToString(); re.time = dr1["Pubdate"].ToString(); remarklist.Add(re); } foreach (var item in remarklist) { html += string.Format(@"<li class='in'> <img src='images/anonymous.png' alt='' class='avatar'> <div class='message'> <span class='arrow'></span> <a class='name' href='#'>{0}</a> <span class='datetime'>at {1}</span> <span class='body'> {2} </span> </div> </li>", item.username, item.time, item.content); } return(html); }
public void InsertWorkLog(string UserName, string WorkTime, string WorkInfo) { string sql = "insert into WorkLog values('" + UserName + "','" + WorkTime + "','" + WorkInfo + "')"; OperateDB.ExecuteNonQuery(sql); }