• This topic is .NET related since the only differences here are based on the processing of the query results. You should choose a simple method to get data back from sql server and get starting processing teh data. An easy way which is well described in millions of tutorials is using the technique with SqlDataAdapter, SqlCommand, SqlConnection and Datatables.

    When the query returns a scalar result, most of this logic is not even needed because you can execute the query with an SqlCommand.ExecuteScalar() method and implicitly cast the result to the correct datatype. (int dbid = (int)cmd.ExecuteScalar();)

    You can find more information on the various classes by googling "MSDN .net datatable" etc.