none
Column is constrained to be unique raised for string type column

    Question

  • I have a string type column made unique in a dataset. I'm tring to insert two values ' Space' and ' Space '. When i insert the second value i get the exception that the value ' Space ' already exist.

    Is there a way to change the dataset/datatable/datacolumn so that the two values will not raised the exception?

    Wednesday, October 27, 2010 9:53 AM

Answers

  • But the values are not equal. They are different by a whitespace.

    Does this mean that the DataColumn does not recognize whitespaces in column values?


    ANSi SQL string comparisons, wichh these datasets seem to use, ignore trailing spaces
    Dave Frommer - BI Architect Slalom Consulting (www.slalom.com)
    • Marked as answer by ARHANGEL19 Wednesday, October 27, 2010 12:31 PM
    Wednesday, October 27, 2010 12:28 PM

All replies

  • Hi Arhangel19,

    Please provide with the code, that how you have created the dataset. Then it's easy to provide you with an answer..


    Manjuke Fernando ~ http://www.manjuke.com
    Wednesday, October 27, 2010 10:45 AM
  • The dataset was generated by the Visual Studio.

    The string type column has AllowDBNull on false and Unique on true.

    The .net version is 2.0

    Wednesday, October 27, 2010 10:58 AM
  • If a column is unique, you are not allow to insert duplicate values.. 
    Manjuke Fernando ~ http://www.manjuke.com
    Wednesday, October 27, 2010 11:15 AM
  • But the values are not equal. They are different by a whitespace.

    Does this mean that the DataColumn does not recognize whitespaces in column values?

    Wednesday, October 27, 2010 11:16 AM
  • If the dataset is generated by the designer, then it is according the constraints in the DataBase. So a DNValue.null would be common and two times a " " is simply a discrepant in the constraints. 

    Be aware that a space is not an empty string, although I assume that both will act likewise.

     


    Success
    Cor
    Wednesday, October 27, 2010 11:32 AM
  • But the values are not equal. They are different by a whitespace.

    Does this mean that the DataColumn does not recognize whitespaces in column values?


    ANSi SQL string comparisons, wichh these datasets seem to use, ignore trailing spaces
    Dave Frommer - BI Architect Slalom Consulting (www.slalom.com)
    • Marked as answer by ARHANGEL19 Wednesday, October 27, 2010 12:31 PM
    Wednesday, October 27, 2010 12:28 PM