How to run a query statement using SqlQuery and DbContext RRS feed

  • Question

  • hi all

    i am trying to run a simple statement which returns me a date (String) but i cant get the proper syntaxe :

            private static string GetMinUpgradeDate()
                UpgradeDataContext db = new UpgradeDataContext();
                //return db.Database.SqlQuery(typeof(string), "select min(UpgradeDate) from dbo.NightlyTargets");
                //return db.Database.SqlQuery<string>("select min(UpgradeDate) from dbo.NightlyTargets");
                    //Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<string>' to 'string'

    any ideas?

    thank you

    • Edited by Maximusdm Thursday, October 27, 2011 3:15 AM
    Thursday, October 27, 2011 3:15 AM


All replies