BlogEngine.Net 1.XX where have you gone?

Building a Linq Query gives me a question.

3. April 2008 23:12 by scott in   //  Tags: , , ,   //   Comments (17)

So here I am building a new site that will estimate around 500,000 page views and 50,000 database transactions DAILY.  I am currently working on a simple query that selects ONE row[column] from a database and returns the value to the rest of the methods.  I have a simple thought or question I would like answered and thought this would be a place to bring it up.

Is the foreach loop required even if I know I will receive only 1 record back from the database?

That's it and to give you an example:

        CS_Code.DataContext db = new CS_Code.DataContext(SQLStatementsCS.ConnectionStringID());
        var query = from RN in db.Province
                    where RN.Name == Name
                    select RN.uid;

        int value;
        foreach (var uid in query)
        { value = uid; }


I think it is kind of pointless to create a foreach loop and use 3 lines of code to just get an ID out of the database. So let me know in the comments section if this is the only answer and I will point out the answer and give you a link back to a site of your choice.

Thanks guys and dolls.

kick it on DotNetKicks.com