private void btnconfirm_Click(object sender, EventArgs e) { if (dgvAE.SelectedRows.Count != 1) { MessageBox.Show("请选择一行"); return; } StringBuilder sb = new StringBuilder(); sb.Append("insert into Assess ([EmploerId], [AssesContent],[Score],[SelfScore],[LeaderScore],[AssessMonth])"); sb.Append(" select "); sb.Append(EmploryId); sb.Append(" ,ASDContent"); sb.Append(" ,Score"); sb.Append(" ,0"); sb.Append(" ,0,'"); sb.Append(AssesTime); sb.Append("' from ASEDetail where AssessExampleId="); sb.Append(dgvAE.SelectedRows[0].Cells["AssExampleId"].Value.ToString()); if (Common.helper.ExecuteNonQuery(Common.helper.connectionStr, sb.ToString()) > 0) { MessageBox.Show("导入成功"); asses.BindAssess(); this.Close(); } else { MessageBox.Show("导入失败"); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtContent.Text.Trim() == string.Empty) { MessageBox.Show("考核内容不能为空"); return; } else if (txtScore.Text.Trim() == string.Empty) { MessageBox.Show("分数不能为空"); return; } StringBuilder sb = new StringBuilder(); sb.Append("insert into Assess ([EmploerId], [AssesContent],[Score],[SelfScore],[LeaderScore],[AssessMonth])"); sb.Append(" values("); sb.Append(EmploryId); sb.Append(" ,'"); sb.Append(txtContent.Text.Trim()); sb.Append(" ','"); sb.Append(txtScore.Text.Trim()); sb.Append(" ',0"); sb.Append(" ,0,'"); sb.Append(AssesTime); sb.Append(" ')"); if (Common.helper.ExecuteNonQuery(Common.helper.connectionStr, sb.ToString()) > 0) { MessageBox.Show("添加成功"); asses.BindAssess(); this.Close(); } else { MessageBox.Show("添加失败"); } }