private void add_Click(object sender, EventArgs e) { SuperMarketDataClassesDataContext db = new SuperMarketDataClassesDataContext(); SIMS_user user = new SIMS_user(); user.userName = userName.Text; user.userPwd = passWord.Text; if (radioButton1.Checked) { user.userSex = "男"; } else if (radioButton2.Checked) { user.userSex = "女"; } user.userPhone = phone.Text; user.note = remarks.Text; db.SIMS_user.InsertOnSubmit(user); try { db.SubmitChanges(); MessageBox.Show("添加成功!"); dataGridView1.DataSource = db.SIMS_user; } catch (Exception ex) { } }
partial void UpdateSIMS_user(SIMS_user instance);
partial void DeleteSIMS_user(SIMS_user instance);
partial void InsertSIMS_user(SIMS_user instance);