Entities edmx

Hi guys,

I have asp.net mvc 4 project and i work with entities edmx to connect database.

Now I have implemented some stored proc see below:

USE [ALTh]
GO
/****** Object:  StoredProcedure [dbo].[DlvryProcessStep2a]    Script Date: 10/27/2015 12:26:39 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- show items in Delivery
ALTER PROC [dbo].[DlvryProcessStep2a]
@headerid INT = NULL
AS
-- Show WorkOrderID
BEGIN
select a.OrderID AS WorkOrderID
from dbo.T_Dlvry_Header AS A 
where a.ID = @headerid 
END

-- Show Customer Information
BEGIN 
select a.storeid, b.AccountNumber, b.lastname, b.PhoneNumber, b.EmailAddress
from dbo.T_Dlvry_Header AS A 
inner join RMSmasterDBtest.dbo.Customer AS B on b.id = a.CustomerID
END


-- Show ShipTo
BEGIN
select 
CASE 
when a.Shipto = 0 THEN b.[Address] + ' ' + b.[Address2] + ' ' + b.City + ' ' + b.Country
ELSE c.Address + ' ' + c.Address2 + ' ' + c.City + ' ' + c.Country
END AS Shipto 
from T_Dlvry_Header AS A 
inner join rmsmasterdbtest.dbo.customer AS B on b.id = a.CustomerID 
left join  rmsmasterdbtest.dbo.shipto AS C  on c.id = a.shipto
where a.id = @headerid
END

-- Show item infromation
BEGIN
select b.itemlookupcode, b.description, a.Qty
from dbo.T_Dlvry_Entry AS A 
inner join RMSmasterDBtest.dbo.item AS B on b.id = a.itemid
where a.HeaderID = @headerid 
END

Open in new window


Issue is:

When I'm trying to connect to the selected field from stored pro I get no values:

See my qury C# below:

ALThompsonEntities db = new ALThompsonEntities();
            var itmq = db.DlvryProcessStep2a(hdid).Select(p => new Delvitementry
            {
                ILC = p.des
            }

Open in new window

LVL 1
Moti Mashiah.NET DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Moti Mashiah.NET DeveloperAuthor Commented:
HI Guys,

I figure out that I'm getting just the column of the first select in the procedure.

look at my attach example and the see the procedure above:
ado.png
0
Moti Mashiah.NET DeveloperAuthor Commented:
The problem is that I'm getting just the column from the first select.

How can I get all the columns from all the selects in the procedure.
0
Vitor MontalvãoMSSQL Senior EngineerCommented:
Stored Procedure only have one BEGIN..END block so remove the inner blocks:
USE [ALTh]
GO
/****** Object:  StoredProcedure [dbo].[DlvryProcessStep2a]    Script Date: 10/27/2015 12:26:39 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- show items in Delivery
ALTER PROC [dbo].[DlvryProcessStep2a]
@headerid INT = NULL
AS
-- Show WorkOrderID
BEGIN
select a.OrderID AS WorkOrderID
from dbo.T_Dlvry_Header AS A 
where a.ID = @headerid 

-- Show Customer Information
select a.storeid, b.AccountNumber, b.lastname, b.PhoneNumber, b.EmailAddress
from dbo.T_Dlvry_Header AS A 
inner join RMSmasterDBtest.dbo.Customer AS B on b.id = a.CustomerID

-- Show ShipTo
select 
CASE 
when a.Shipto = 0 THEN b.[Address] + ' ' + b.[Address2] + ' ' + b.City + ' ' + b.Country
ELSE c.Address + ' ' + c.Address2 + ' ' + c.City + ' ' + c.Country
END AS Shipto 
from T_Dlvry_Header AS A 
inner join rmsmasterdbtest.dbo.customer AS B on b.id = a.CustomerID 
left join  rmsmasterdbtest.dbo.shipto AS C  on c.id = a.shipto
where a.id = @headerid


-- Show item infromation
select b.itemlookupcode, b.description, a.Qty
from dbo.T_Dlvry_Entry AS A 
inner join RMSmasterDBtest.dbo.item AS B on b.id = a.itemid
where a.HeaderID = @headerid 
END

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Moti Mashiah.NET DeveloperAuthor Commented:
Thx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.