You need to use a database connection object of the correct flavor for your database (such as SqlConnection), then the right flavor command object (such as SqlCommand) so you can construct the actually query to run. You can call <commandObject>.ExecuteScalar() to retrieve the first column of the first row returned by the query.
-
Peter