Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi ,
i am beginner in Entity framework
i have stored procedure that select data from 3 tables based on relation between them

usually when i need to retrieve data from one table i go to Add function import , choose return type : Entities and then choose table name , then the data will be displayed .
and when i need to retrieve a scalar value i choose return type :Scalar

there is one more option called complex , should i choose it ???
and how to get the all data from 3 table in one GridView

note : when i run the stored procedure is sql server , it works fine .
i need to get these data in a grid view
Posted
Comments
Herman<T>.Instance 19-May-14 10:53am    
what is your problem?
Hercal 19-May-14 11:29am    
how i bind this grid ?
karthik Udhayakumar 19-May-14 19:18pm    
Which Grid and where is your code?
Generally you need to use a Template Field with eval to achieve data binding in EF.

Even you have to do function import for the stored procedure as well and create a new complex type to get the desired data. Please go through this blog post written by me for steps to achieve what you want :-

Using stored procedures in Entity Framework Model First Approach (Part I - Adding New Stored procedure)[^]

OR

http://microsofttechnologiesmaster.blogspot.in/2014/04/using-stored-procedures-in-entity.html?m=1

Hope this will definitely of help to you.
 
Share this answer
 
Hai u should select Complex type why because return type is Table ,

or Else

C#
var Query = from Wi in objShortcutDAO.Table1
                        join Wt in objSettings.Table2 on Wi.WorkTypeID equals Wt.WorkTypeID
                        join t in objSettings.Table3  on Wi.TradeID equals t.TradeID
                        join u in objSettings.Table4 on Wi.UnitID equals u.UnitID
                        where Wi.WorkOrderItemID == Convert.ToInt32(e.Value)

                        select new
                        {
                      Name = t.TradeName + "," + u.UnitName + "," +       Wt.WorkTypeName,                
                      Id = t.TradeID + "," + Wt.WorkTypeID + "," + u.UnitID

                        };
 
Share this answer
 

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