public DataSet GetTutorComment(string id) { string sql = "select * from TutorComment where TutorID=@id"; SqlParameter[] pa = { new SqlParameter("@id", id) }; return(ba.GetDataSet(sql, pa)); }
/// <summary> /// 返回订单学生的基本信息 /// </summary> /// <returns></returns> public DataSet GetAllResStuBYTutorID(string id) { string sql = "select * from ResStu where TutorID=@id order by Time desc"; SqlParameter[] pa = { new SqlParameter("@id", id) }; DataSet ds = ba.GetDataSet(sql, pa); return(ds); }
private void bind() { GridView1.Columns[5].Visible = true; GridView2.Columns[5].Visible = true; GridView1.Columns[7].Visible = true; GridView2.Columns[7].Visible = true; GridView1.Columns[8].Visible = true; GridView2.Columns[8].Visible = true; string date = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"); string sql1 = "select * from Chat where RecieveUID=@id and Time>@date"; string sql2 = "select * from Chat where RecieveUID=@id and Time<=@date"; SqlParameter[] pa1 = { new SqlParameter("@id", RID), new SqlParameter("@date", date) }; SqlParameter[] pa2 = { new SqlParameter("@id", RID), new SqlParameter("@date", date) }; DataSet myds1 = ba.GetDataSet(sql1, pa1); GridView1.DataSource = myds1; GridView1.DataKeyNames = new string[] { "Title", "ChatContent", "Time", "IsRead", "ChatID", "SendUID" }; GridView1.DataBind(); DataSet myds2 = ba.GetDataSet(sql2, pa2); GridView2.DataSource = myds2; GridView2.DataKeyNames = new string[] { "Title", "ChatContent", "Time", "IsRead", "ChatID", "SendUID" }; GridView2.DataBind(); GridView1.Columns[5].Visible = false; GridView2.Columns[5].Visible = false; GridView1.Columns[7].Visible = false; GridView2.Columns[7].Visible = false; GridView1.Columns[8].Visible = false; GridView2.Columns[8].Visible = false; this.DropDownList1.Items.Clear(); this.DropDownList2.Items.Clear(); for (int i = 1; i <= this.GridView1.PageCount; i++) { this.DropDownList1.Items.Add(i.ToString()); } if (GridView1.Rows.Count > 0) { this.DropDownList1.SelectedIndex = this.GridView1.PageIndex; } for (int i = 1; i <= this.GridView2.PageCount; i++) { this.DropDownList2.Items.Add(i.ToString()); } if (GridView2.Rows.Count > 0) { this.DropDownList2.SelectedIndex = this.GridView2.PageIndex; } }
public DataRow userLogin(string username, string password) { string sql = "select * from tb_User where UserName = @username and Password = @passwd and Type<>2"; SqlParameter[] para = new SqlParameter[2] { new SqlParameter("@username", username), new SqlParameter("@passwd", password) }; DataSet ds = ba.GetDataSet(sql, para); if (ds.Tables[0].Rows.Count <= 0) { return(null); } else { return(ds.Tables[0].Rows[0]); } }
private void bind() { string sql1 = "select * from CourseJoin where TutorID=@tutorID"; SqlParameter[] pa1 = { new SqlParameter("@tutorID", tutorID) }; DataSet myds1 = ba.GetDataSet(sql1, pa1); GridView1.DataSource = myds1; GridView1.DataKeyNames = new string[] { "JoinID", "Grade", "CourseID", "Cost" }; GridView1.DataBind(); this.DropDownList3.Items.Clear(); for (int i = 1; i <= this.GridView1.PageCount; i++) { this.DropDownList3.Items.Add(i.ToString()); } if (this.GridView1.PageIndex != 0) { this.DropDownList3.SelectedIndex = this.GridView1.PageIndex; } }
private void Bind() { string sql1 = "select * from Student where StuID=@stuID"; SqlParameter[] pa1 = { new SqlParameter("@StuID", stuID) }; DataSet ds = ba.GetDataSet(sql1, pa1); TextBox1.Text = ds.Tables[0].Rows[0][1].ToString(); TextBox2.Text = ds.Tables[0].Rows[0][3].ToString(); TextBox3.Text = ds.Tables[0].Rows[0][4].ToString(); TextBox4.Text = ds.Tables[0].Rows[0][5].ToString(); TextBox5.Text = ds.Tables[0].Rows[0][6].ToString(); }
public DataSet GetTopNews() { string sql = "select top 5 * from News where IsTop=1 order by newid()"; DataSet ds = ba.GetDataSet(sql, null); return(ds); }
public DataSet GetTopTutor() { //string sql = "select top 8 * from Tutor where Rank=1"; string sql = "select top 8 * from TutorAndTop where iftop = 1"; return(ba.GetDataSet(sql, null)); }
// ~CourseDAO() //{ // ba.Close(); //} public DataSet GetAllCourses() { string sql = "select * from Course"; return(ba.GetDataSet(sql, null)); }
// ~StaffDAO() //{ // ba.Close(); //} public DataSet GetStaffByDepartment(string departmentId) { string sql = "select * from Staff where DepartmentID = " + departmentId; return(ba.GetDataSet(sql, null)); }