title: Having trouble with entity to make sql queries
body: <p>I am following this tutorial and I have no idea how to use Entity SQL: or Native SQL. Can someone help?</p>
  
  <p><a href="http://www.entityframeworktutorial.net/Querying-with-EDM.aspx" rel="nofollow noreferrer">http://www.entityframeworktutorial.net/Querying-with-EDM.aspx</a></p>
  
  <p>When I try to run the code provided, after having changed the lightblue text to something matching my project, I keep getting:</p>
  
  <blockquote>
    <p>Error  1   'foo.PMEntities' does not contain a definition for 'ExecuteStoreCommand' and no extension >method 'ExecuteStoreCommand' accepting a first argument of type 'foo.PMEntities' could be found (are you >missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>ExecuteStoreQuery and CreateQuery also have the same issue.</p>
  
  <p>I looked at my references and I think things should be fine.</p>
  
  <p><a href="https://i.stack.imgur.com/50zxG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/50zxG.png" alt="a busy cat"></a>
  </p>
  
  <p>I can query with linq to entities just fine but I'm not very used to Linq.</p>
  
  <p>Example code: 
  `public ActionResult CharlieTest()
          {
              using (var objCtx = new PMEntities())
              {
                  var schoolCourse = from cs in objCtx.Courses
                                     where cs.CourseName == "Course1"
                                     select cs;
                  //"Cours" correlates to a course
                  Cours mathCourse = schoolCourse.FirstOrDefault();
                  IList courseList = schoolCourse.ToList();</p>
  
  <pre><code>            string courseName = mathCourse.CourseName;
          }
  
          //Querying with Object Services and Entity SQL
          //Entity SQL does not recognize certain statements like createQuery and I can't add a reference to something that will help
          //using (var objCtx = new PMEntities())
          //{
          //    string sqlString = "SELECT VALUE cs FROM SchoolDBEntities.Courses AS cs WHERE cs.CourseName == 'Maths'";
          //    ObjectQuery&lt;Cours&gt; course = objCtx.
          //        &lt;Cours&gt;(sqlString);
          //    Cours coursename1 = course.FirstOrDefault&lt;Cours&gt;();
          //}
  
  
          //nativeSQL also doesn't work. Can not find ExecuteStoreCommand or ExecuteStoreQuery
          using (var objCtx = new PMEntities())
          {
              //Inserting Student using ExecuteStoreCommand
              int InsertedRows = objCtx.Database.SqlQuery("Insert into Student(StudentName,StandardId) values('StudentName1',1)").ToArray();
  
              //Fetching student using ExecuteStoreQuery
              var student = objCtx.Database.SqlQuery&lt;Cours&gt;("Select * from Student where StudentName = 'StudentName1'", null).ToList();
  
          } 
  
          return View();
      }`
  </code></pre>
  
  <p>Merry Christmas Eve everyone!</p>