Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i wanted to do this

context db=new context();
var c=db.database.SqlQuery("SELECT a,b,c,d FROM table1").ToList();

i'm using edmx schema first. why the db.database is not available?
Posted
Comments
Jameel VM 6-Mar-13 1:09am    
database is not the default property.Whenever an edmx created automatically create ObjectDataContext.For example when we create an edmx on the basis of Product table(automatically create ProductObjectSet) then you can use db.Products.SqlQuery()
scorpzonex 6-Mar-13 1:26am    
yes but that's when you are querying against specific table like product, but what to do in case of two or more tables like select * from table A,B,C,D; http://msdn.microsoft.com/en-us/data/jj592907.aspx see the examples of "Sending raw commands to the database" and "Writing SQL queries for non-entity types" and specially ***"Writing SQL queries for entities" which i'm trying to do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900