Check string contains Null,empty and spaces.

null,empty, and spaces are different so check each before inserting data into database

For null or empty data use -

String.IsNullOrEmpty("") which returns true value
If data is empty or null otherwise returns false.

For spaces -
But if data contains space it returns false using above function. To avoid it use

String.IsNullOrEmpty(" ".Trim) then and then it return true.


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: