Esempio n. 1
0
 //Method implemented on direct button click
 protected void DelBut_Click(object sender, EventArgs e)
 {
     using (LinqClassDataContext delete = new LinqClassDataContext())
     {
         ProTab1 delvalue = delete.ProTab1s.SingleOrDefault(value => value.LName == "lorry");
         delete.ProTab1s.DeleteOnSubmit(delvalue);
         delete.SubmitChanges();
         GetData();
     }
 }
Esempio n. 2
0
 //Method to DisplayData
 private void GetData()
 {
     LinqClassDataContext context = new LinqClassDataContext();
     {
         //Logger is used to log data and provide query syntax
         context.Log = Response.Output;
         ProjectionView.DataSource = context.ProTab1s;
         ProjectionView.DataBind();
     }
 }
Esempio n. 3
0
 //Method storage area
 //Method to update the table
 private void UpdateMethod()
 {
     using (LinqClassDataContext update = new LinqClassDataContext())
     {
         ProTab1 insMet = update.ProTab1s.SingleOrDefault(value => value.LName == UpdOldLName.Text);
         insMet.LName = UpdNewLName.Text.ToString();
         update.SubmitChanges();
         GetData();
     }
 }
Esempio n. 4
0
 //Method contains Code for insertion
 private void InsertData()
 {
     using (LinqClassDataContext context = new LinqClassDataContext())
     {
         ProTab1 instab = new ProTab1
         {
             Name  = TextBox1.Text.ToString(),
             LName = TextBox2.Text.ToString()
         };
         context.ProTab1s.InsertOnSubmit(instab);
         context.SubmitChanges();
         GetData();
     }
 }