コード例 #1
0
 protected void btnAddNewMember_Click(object sender, EventArgs e)
 {
     try
     {
         using (var db = new CommunitySystemDataContext())
         {
             Members mb = new Members()
             {
                 First_Name    = txtFirstName.Text,
                 Last_Name     = txtLastName.Text,
                 Email         = txtEmail.Text,
                 Contact_No    = txtContactNo.Text,
                 Date_Of_Birth = Convert.ToDateTime(txtDOB.Text),
                 Password      = txtPassword.Text
             };
             db.Members.InsertOnSubmit(mb);
             db.SubmitChanges();
         }
         lblMessage.Text = "You are a Member Now !";
     }
     catch (Exception ex)
     {
         lblMessage.Text = ex.Message;
     }
 }
コード例 #2
0
 private void AutoUpdateGridView()
 {
     try
     {
         using (var db = new CommunitySystemDataContext())
         {
             var us = from uss in db.Members
                      select uss;
             txtGridView.DataSource = us;
             txtGridView.DataBind();
         };
     } catch (Exception ex)
     {
         lblgridmsg.Text = ex.Message;
     }
 }