我添加数据,但是重复的数据添加就出错,需要一个给出提示(在线等,马上给分)
string sql = "INSERT INTO TBL_CourseDetail(CourseSn,CourseCode,CourseSeq,Teacher,TermID,PlanID,TeachModecode) " +
" VALUES (global_sequence_function( 'TBL_CourseDetail '),:CourseCode,:CourseSeq,:Teacher,:TermID,:PlanID,:TeachModecode) ";//,Numbers,ExaminingTime,ExaminingPlace,:Numbers,:ExaminingTime,:ExaminingPlace
OracleDataAccess oda = new OracleDataAccess();
OracleParameter b = new OracleParameter( ":CourseCode ", this.droplCourse.SelectedValue);
OracleParameter c = new OracleParameter( ":CourseSeq ", this.droplCourseSeq.Text);
OracleParameter d = new OracleParameter( ":Teacher ", this.droplTeacher.Text);
OracleParameter f = new OracleParameter( ":TermID ", this.droplTerm.SelectedItem.Value);
OracleParameter g = new OracleParameter( ":PlanID ", this.droplPlan.SelectedItem.Value);
OracleParameter h = new OracleParameter( ":TeachModecode ", this.droplTeachStyle.Text);
OracleParameter[] ops ={ b, c, d, f, g, h };
oda.ExecuteNonQuery(sql, ops);
[解决办法]