Exemple #1
0
 protected void Delete_Details(object sender, EventArgs e)
 {
     using (lab7DataContext dbcontext = new lab7DataContext())
     {
         student stud = dbcontext.students.SingleOrDefault(x => x.sid == Convert.ToInt32(Sid.Text));
         dbcontext.students.DeleteOnSubmit(stud);
         dbcontext.SubmitChanges();
         Label1.Text = "Data Deleted Successfully!";
     }
 }
Exemple #2
0
 protected void Fill_Details(object sender, EventArgs e)
 {
     using (lab7DataContext dbcontext = new lab7DataContext())
     {
         //id = Convert.ToInt32(Sid.Text);
         student stud = dbcontext.students.SingleOrDefault(x => x.sid == Convert.ToInt32(Sid.Text));
         Name.Text      = stud.name;
         Sem.Text       = Convert.ToString(stud.sem);
         CPI.Text       = Convert.ToString(stud.cpi);
         ContactNo.Text = Convert.ToString(stud.contact_no);
         Email.Text     = stud.email_id;
         Fields.Visible = true;
     }
 }
Exemple #3
0
        protected void Update_Details(object sender, EventArgs e)
        {
            using (lab7DataContext dbcontext = new lab7DataContext())
            {
                student stud = dbcontext.students.SingleOrDefault(x => x.sid == Convert.ToInt32(Sid.Text));
                stud.name       = Name.Text;
                stud.sem        = Convert.ToInt32(Sem.Text);
                stud.cpi        = Convert.ToDecimal(CPI.Text);
                stud.contact_no = Convert.ToDecimal(ContactNo.Text);
                stud.email_id   = Email.Text;

                dbcontext.SubmitChanges();
                Label1.Text = "Data Updated Successfully!";
            }
        }
Exemple #4
0
        /*protected void db_init()
         * {
         *  con = new SqlConnection();
         *  con.ConnectionString = WebConfigurationManager.ConnectionStrings["Con1"].ConnectionString;
         * }*/
        protected void Insert_Details(object sender, EventArgs e)
        {
            using (lab7DataContext dbcontext = new lab7DataContext())
            {
                student stud = new student
                {
                    name       = Name.Text,
                    sem        = Convert.ToInt32(Sem.Text),
                    cpi        = Convert.ToInt32(CPI.Text),
                    contact_no = Convert.ToDecimal(ContactNo.Text),
                    email_id   = Email.Text
                };

                dbcontext.students.InsertOnSubmit(stud);
                dbcontext.SubmitChanges();
                Label1.Text = "Data Inserted Successfully!";
            }
        }