コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            int     n = int.Parse(txtid.Text);
            studint s = db.studint.FirstOrDefault(y => y.id == (n));

            txtadrs.Text = s.adress;
            txtage.Text  = s.age.ToString();
            txtname.Text = s.name;
        }
コード例 #2
0
        private void add_studentdata()
        {
            studint s = new studint();

            s.name   = txtname.Text;
            s.age    = int.Parse(txtage.Text);
            s.adress = txtadrs.Text;
            db.studint.Add(s);
            db.SaveChanges();
            MessageBox.Show("datasaved bay");
        }