this is my stored procedure which i created. I added in my .edmx file by clicking "update database model".
How do i call the procedure in mvc3razor application using c#.
CREATE PROCEDURE GetGradeBook
AS
BEGIN
DECLARE @AssignmentList varchar(3000),@Sql varchar(max)
SET @AssignmentList =STUFF((SELECT DISTINCT ',[' + assignmentname + ']' FROM assignment where coursesectionid='b78a6efe-ac77-4e49-806a-fc2fad71068b' FOR XML PATH('')),1,1,'')
SET @Sql ='select *
from
(
select p.firstname,p.lastname,a.assignmentname,a.pointspossible
from person2 p
inner join coursesectionroster cs
on cs.personid = p.personid
inner join assignment a
on a.coursesectionid = cs.coursesectionid
left join assignmentsubmission asg
on a.assignmentid=asg.assignmentid
where cs.coursesectionid=''b78a6efe-ac77-4e49-806a-fc2fad71068b''
and cs.courserole=2
)t
PIVOT(SUM(pointspossible) FOR assignmentname IN(' + @AssignmentList + '))p'
EXEC (@SQL)
END
Loading

Iftikar HussainRank #423 · 5.9K reputationPosted Jul 1, 2013, 10:34 PM EDT
Please refer the below link
http://social.msdn.microsoft.com/Forums/en-US/a7e15e64-5724-44ce-a047-d256424a1e7f/how-to-call-stored-procedure-from-entity-framework
http://www.c-sharpcorner.com/UploadFile/abhikumarvatsa/using-stored-procedure-entity-framework-in-mvc-4-to-create/
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 1, 2013, 11:15 PM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 1, 2013, 11:16 PM EDT
http://yassershaikh.com/how-to-call-stored-procedure-from-entity-framework-in-asp-net-mvc/
http://www.itorian.com/2012/09/using-stored-procedure-entity-framework.html
Kunal VaishyaRank #990 · 2K reputationPosted Jul 1, 2013, 11:24 PM EDT
vidhyaRank #4,868 · 321 reputationPosted Jul 1, 2013, 11:25 PM EDT
code in
<oracle.dataaccess.client><settings><addname="SCOTT.EMP_GETLIST.RefCursor.o_cursor"value="implicitRefCursor bindinfo='mode=Output'"/>settings>oracle.dataaccess.client>Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 1, 2013, 11:30 PM EDT
Riyaz AkhtarRank #2,275 · 619 reputationPosted Jul 1, 2013, 11:34 PM EDT
http://msdn.microsoft.com/en-us/data/jj557860
http://msdn.microsoft.com/en-us/data/jj593489
vidhyaRank #4,868 · 321 reputationPosted Jul 1, 2013, 11:43 PM EDT
In AddFunctionImport,
i need to select complex. No complex added there. i m trying to add the complex by clicking "GetColumnInformation" it returns "Selected stored procedure returns no columns".
How do i add the complex type.
vidhyaRank #4,868 · 321 reputationPosted Jul 1, 2013, 11:56 PM EDT
I cant able to add directly. so i tried to function import. it also got failed.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 2, 2013, 12:23 AM EDT
Please follow the below step
1. Right click on EDMX and click option Add->Function Import
2. Enter Function Import Name, Select the correct Stored Procedure from combo, Select Complex option as Returns a Collection of
3. Click on Get Column Information button. it will return your column information
4. Click on Create New Complex Type button
5. Enter the Complex type name and click OK button
6. Now it will create a new Complex result type under .tt
7.Then in your controler you can call this function
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 2, 2013, 12:39 AM EDT
Instead of showing the column names it shows "Selected stored procedure returns no columns".
Thats great problem for me now. First i need to rectify this.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 2, 2013, 12:48 AM EDT
Regards,
Iftikar
Riyaz AkhtarRank #2,275 · 619 reputationPosted Jul 2, 2013, 12:48 AM EDT
http://msdn.microsoft.com/en-us/data/hh859577
vidhyaRank #4,868 · 321 reputationPosted Jul 2, 2013, 1:00 AM EDT
first we need to add function import . Then only we can map the function.
dilipkumar regana75 reputationPosted Sep 10, 2013, 9:44 PM EDT