As we know that when you try to find the result of a single column, we can use executeScalar which is much faster process of data retrieval. But its not a good option for null value records or no result queries. So using this method you can use to check if the result obtained is null or if it has any value.
#ExecuteScalar #nullvalueinExecuteScalar #csharp
You can also use isnull(sum(columnName),0) in your query to show 0 when there is null value. This is very important as it can throw exception in your c# application.