I am using the following SQL query and the ExecuteScalar() method to fetch data from an Oracle database:
ExecuteScalar()
sql = \"select username from usermst wh
In your case either the record doesn't exist with the userid=2 or it may contain a null value in first column, because if no value is found for the query result used in SQL command, ExecuteScalar() returns null.
userid=2
null