471,086 Members | 1,169 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,086 software developers and data experts.

LINQ Query : How to return a single value from a stored procedure

How do we return a single value from a stored procedure.

Suppose I have a stored procedure like this:

create proc dbo.spInsertGroup
@ID uniqueidentifier
@GroupName varchar(100),
@IsActive bit
AS
BEGIN

SET @ID = newid()

insert into tblGroup
values(@ID, @GroupName, @IsActive)

select @ID

END

i am trying to return the same value using LINQ to SQL using stored
procedure.
But all the methods are failing as those types do not have a default
constructor

Is there any method by which i can perform this task.
Oct 15 '08 #1
1 5406
LINQ does not support stored procedure. the LINQ to SQL data designer
supports adding stored procedure calls as methods to a data context. the
return value will be a collection of values. you will need to write your own
method if you just want a single return value.

-- bruce (sqlwork.com)
"psycho" wrote:
How do we return a single value from a stored procedure.

Suppose I have a stored procedure like this:

create proc dbo.spInsertGroup
@ID uniqueidentifier
@GroupName varchar(100),
@IsActive bit
AS
BEGIN

SET @ID = newid()

insert into tblGroup
values(@ID, @GroupName, @IsActive)

select @ID

END

i am trying to return the same value using LINQ to SQL using stored
procedure.
But all the methods are failing as those types do not have a default
constructor

Is there any method by which i can perform this task.
Oct 15 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Thomas R. Hummel | last post: by
7 posts views Thread by Ronald S. Cook | last post: by
28 posts views Thread by Marc Gravell | last post: by
1 post views Thread by shapper | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.