79150079

Date: 2024-11-02 06:28:58
Score: 1.5
Natty:
Report link

That's easy. Just trim and check the value. You could add a short-if statement like (splitLine[2].toString() != "2" ? "1" : "2") Or check (string.IsNullOrEmpty(splitLine[2]) ? "1" : "2") is null or empty. But to be honest... Adding values like this way is very very bad. You know, every person has his own idea about entering values and this will almost always causing problems. I would recommend using a Textbox for every column and after pushing the 'Apply' or 'Insert' button, check every input from the textboxes if they contain the values you would like to accept.

The most errors occurs with user input! What if somebody enters four instead of 4?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Paul Albers