Ejemplo n.º 1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     using (studentDataContext studentDataContext1 = new studentDataContext())
     {
         try {
             student1 student = studentDataContext1.student1s.SingleOrDefault
                                    (x => x.sid == int.Parse(sid.Text.ToString()));
             if (student == null)
             {
                 Label1.Text      = "pleas enter valid input";
                 Label1.ForeColor = System.Drawing.Color.Red;
             }
             else
             {
                 name.Text     = student.name;
                 cpi.Text      = student.cpi;
                 sem.Text      = student.sem;
                 contacno.Text = student.contactno;
                 emailid.Text  = student.emailid;
             }
         }
         catch (System.NullReferenceException err)
         {
             Label1.Text      = "pleas enter valid input";
             Label1.ForeColor = System.Drawing.Color.Red;
         }
     }
 }
Ejemplo n.º 2
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     using (studentDataContext studentDataContext1 = new studentDataContext())
     {
         student1 student = studentDataContext1.student1s.SingleOrDefault
                                (x => x.sid == int.Parse(sid.Text.ToString()));
         student.name      = name.Text;
         student.cpi       = cpi.Text;
         student.sem       = sem.Text;
         student.contactno = contacno.Text;
         student.emailid   = emailid.Text;
         studentDataContext1.SubmitChanges();
     }
 }
Ejemplo n.º 3
0
 protected void TextBox1_TextChanged(object sender, EventArgs e)
 {
     using (studentDataContext studentDataContext = new studentDataContext())
     {
         int      id_del = int.Parse(sid.Text.ToString());
         student1 stu    = studentDataContext.student1s.SingleOrDefault(x => x.sid == id_del);
         if (stu == null)
         {
             Label1.Text      = "pleas enter valid input";
             Label1.ForeColor = System.Drawing.Color.Red;
         }
         else
         {
             Label1.Text = "";
             studentDataContext.student1s.DeleteOnSubmit(stu);
             studentDataContext.SubmitChanges();
         }
     }
 }
Ejemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            using (studentDataContext studentDataContext = new studentDataContext())
            {
                String cpi_in      = cpi.Text;
                String name_in     = name.Text;
                String sem_in      = sem.Text;
                String contacno_in = contacno.Text;
                String emailid_in  = emailid.Text;

                student1 student = new student1
                {
                    cpi       = cpi_in,
                    name      = name_in,
                    contactno = contacno_in,
                    emailid   = emailid_in,
                    sem       = sem_in,
                };
                studentDataContext.student1s.InsertOnSubmit(student);
                studentDataContext.SubmitChanges();
            }
        }
Ejemplo n.º 5
0
 partial void Deletestudent1(student1 instance);
Ejemplo n.º 6
0
 partial void Updatestudent1(student1 instance);
Ejemplo n.º 7
0
 partial void Insertstudent1(student1 instance);