How to check existing word before insert? RRS feed

  • Question

  • This is what I have:

    insMyWordDataContext MyWordDC = new insMyWordDataContext();
    MyWord lhbMyWord = new MyWord();
    lhbMyWord.wordID = Guid.NewGuid();
    lhbMyWord.word = txtWord.Text;
    lhbMyWord.usage = txtUsage.Text;
    lhbMyWord.hmgTrans = txtEnglishTrans.Text;
    lhbMyWord.engTrans = txtEnglishTrans.Text;
    lhbMyWord.originate = txtOriginate.Text;
    lhbMyWord.modDate = Convert.ToDateTime(DateTime.Now.ToLongDateString());
    lhbMyWord.insertDate = Convert.ToDateTime(DateTime.Now.ToLongDateString());
    Is there a way to incorporate my insert with checking if the word already exist in the database or not before inserting? Or, do I have to do my verification separately?

    Wednesday, October 27, 2010 2:56 PM