コード例 #1
0
        protected void ButtonAddStudent_Click(object sender, EventArgs e)
        {
            if (TextBoxID.Text.Equals("") || TextBoxName.Text.Equals("") || TextBoxAge.Text.Equals("") || TextBoxUniversity.Text.Equals(""))
            {
                Response.Write("<script language='javascript'>alert('Please fill all the fields.');</script>");
            }
            else
            {
                Student stu = new Student();
                stu.Student_Age = Convert.ToInt32(TextBoxAge.Text);
                stu.Student_Name = TextBoxName.Text;
                stu.Student_Id = TextBoxID.Text;
                stu.Student_University = TextBoxUniversity.Text;
                StudentsDBDataClassesDataContext db = new StudentsDBDataClassesDataContext();
                db.Students.InsertOnSubmit(stu);
                db.SubmitChanges();
                TextBoxID.Text = "";
                TextBoxAge.Text = "";
                TextBoxName.Text = "";
                TextBoxUniversity.Text = "";

            }
        }
コード例 #2
0
 partial void DeleteStudent(Student instance);
コード例 #3
0
 partial void UpdateStudent(Student instance);
コード例 #4
0
 partial void InsertStudent(Student instance);