Exemple #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            netEntities1 db   = new netEntities1();
            新增           new1 = new 新增();

            new1.value("0", "insert");
            new1.ShowDialog();
            var sj = from a in db.sp select new { a.spid, a.spname, a.spgysid, a.spzlid };

            dataGridView1.DataSource = sj.ToList();
        }
Exemple #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                string id = dataGridView1.SelectedRows[0].Cells["spid"].Value.ToString();

                新增 new1 = new 新增();
                new1.value(id, "update");
                new1.ShowDialog();
                netEntities1 db = new netEntities1();
                var          sj = from a in db.sp select new { a.spid, a.spname, a.spgysid, a.spzlid };
                dataGridView1.DataSource = sj.ToList();
            }
            else
            {
                MessageBox.Show("请先选择行!");
            }
        }