Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 483
  • Last Modified:

Property cannot be set to null

I have a field in an SQL db that is an int allow null. I have a property in the class for the SQL View that the data is matched to. In the class the property for the field has the default get and set. When I run the project I get the following error...

The 'SortOrder' property on 'TagSummaryView' could not be set to a 'null' value. You must set this property to a non-null value of type 'Int32'.
0
rawilken
Asked:
rawilken
1 Solution
 
Ivo StoykovCommented:
you could set your property as a nullable, i.e.
int? i = null;

Open in new window

Look here for more info.

HTH

Ivo Stoykov
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now