Posted on: 8/14/2013 2:11:38 AM | Views : 256

Hi all, I want to insert some values into my database however i keep getting a error. What I'm trying to do is insert a new value into my database. If there is a similar value inside the database it should not enter and it will prompt a error message. However, the new value i enter will be able to enter the database even though I already have the same value inside. How do I solve it?
protected void btnSubmit_Click(object sender, EventArgs e) { string ChapName = ChapterName.Text; string SubChapName = SubChapterName.Text; string check = ""; string Tut = (string)Session["TutID"]; SqlConnection conn = new SqlConnection(connStr); SqlCommand cmdCheck = new SqlCommand("Select TutTitle from Tutorial", conn); //SqlCommand cmdInsertSubChapName = new SqlCommand("Update SubTutorial set SubTutText = '"+SubChapName+"' where TutID = '"+Tut+"'",conn); conn.Open( ...

Go to the complete details ...