I have generated an edmx file using entity data model. Would like to use the 'GetCommand' method, which is not in dbContext but in DataContext. So,someone suggested this 'alternate'..
When compiling, there is an error at the sqlcommand line
"This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code."
public DataTable GetAllRecords()
using (DataContext ctx = new DataContext(MedianDB.Connection))
DataSet ds = new DataSet();
DataTable dt = new DataTable();
var query = (from j in MedianDB.tblCountries
orderby j.CountryName ascending
SqlCommand cmd = (SqlCommand)ctx.GetCommand(query); //error here
SqlDataAdapter da = new SqlDataAdapter(cmd);
Is there any chance I could make this work. Im using .Net framework 4.0, C#