Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            MydatabaseDataContext sr = new MydatabaseDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\lenovo\Documents\Visual Studio 2012\Projects\car\car\login.mdf;Integrated Security=True");
            Stock_Register        s  = new Stock_Register();

            s.Date          = Convert.ToDateTime(textBox1.Text);
            s.Type_of_Car   = textBox2.Text;
            s.Model         = textBox3.Text;
            s.Total_Num     = int.Parse(textBox4.Text);
            s.Sales_Number  = int.Parse(textBox5.Text);
            s.Current_Stock = int.Parse(textBox6.Text);
            sr.Stock_Registers.InsertOnSubmit(s);
            sr.SubmitChanges();
            dataGridView1.DataSource = sr.Stock_Registers;
        }
 partial void UpdateStock_Register(Stock_Register instance);
 partial void DeleteStock_Register(Stock_Register instance);
 partial void InsertStock_Register(Stock_Register instance);