public int AddNewItem() { string sql = string.Format("insert into tblStudents (Name,Gender,TotalMarks) values ('{0}',{1},{2})", emp.Name, emp.Gender, emp.Marks); return(ProjectDB.ExcuteNonQuery(sql)); }
public int UpdateItemByID(int id) { string sql = string.Format("update tblStudents set Name='{0}', Gender='{1}', TotalMarks={2} where ID={3}", emp.Name, emp.Gender, emp.Marks, id); return(ProjectDB.ExcuteNonQuery(sql)); }
public employee GetItemsByID() { string sql = "select * from tblStudents where ID=" + emp.empId; DataTable tb = ProjectDB.ExcuteDataTable(sql); emp.Name = tb.Rows[0][1].ToString(); emp.Gender = tb.Rows[0][2].ToString(); emp.Marks = (int)tb.Rows[0][3]; return(emp); }
protected void Page_Load(object sender, EventArgs e) { //only run once(when load the first time if (!Page.IsPostBack) { List <Projects> projectList = new List <Projects>(); projectList = ProjectDB.SearchAllProject(); foreach (Projects project in projectList) { DropDownListProjets.Items.Add(project.ProjectCode); } List <Students> studentList = new List <Students>(); studentList = StudentDB.GetStudentList(); foreach (Students student in studentList) { DropDownListStudents.Items.Add(student.StudentNumber.ToString()); } } }
public object CountItems() { string sql = string.Format("select count(*) from tblStudents"); return(ProjectDB.ExcuteScalar(sql)); }
public DataSet GetAllItems() { string sql = "select * from tblStudents"; return(ProjectDB.ExcuteDataSet(sql)); }