none
Datagridview İnsert doesn't work!!

    Question

  • Hello everybody,

    I am beginner in LINQ. I started to  insert a record in a DB.When I run the project linq2.SubmitChanges(); doesn't work and stop the run.why doesn't it?

     Here's the code.


                    private void button2_Click(object sender, EventArgs e)
            {
                DataClasses1DataContext linq2 = new DataClasses1DataContext();
                lojmanpuan csm = new lojmanpuan();
               
                {   csm.tcno = textBox1.Text;
                    csm.ad   = textBox2.Text;
                    csm.soyad = textBox3.Text;
                    csm.görev = textBox4.Text;
                    csm.unvan = textBox5.Text;
                    linq2.lojmanpuans.InsertOnSubmit(csm);
                   
                }

     linq2.SubmitChanges();
                MessageBox.Show("Saved");
            }

    Friday, February 05, 2016 9:36 PM