Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82610

Unique Validator: Conversion failed when converting the nvarchar value to data type int (.Net MVC)

$
0
0

I am having an issue when using the Unique Validator on Create

.Field(new Field("Serial")
   .Validator(Validation.Unique(new ValidationOpts
    {
         Message = "An asset with this Serial Number already exists."
     }))
)

When I try to create an item with just a number like 1000. I receive the conversion error:

Conversion failed when converting the nvarchar value 'JXRM1D1' to data type int.

This is the serial number column. But I have another column (Tag) that I use Unique on that i receive:

Conversion failed when converting the nvarchar value '000AT0001252' to data type int.

When I try and create them with a number followed by an letter, 1000z, it works.

I have Serial as well as the Tag set to public string in my view model.

Any help would be appreciated.

Thank you.


Viewing all articles
Browse latest Browse all 82610

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>