A single value from a database can be obtained by using the ExecuteScalar method of the SqlCommand object. The first column of the result set's first row is returned by this method.