this is my SP and iam try to get the datatable from sp using LINQ but it is only returning 0.
how can i get datatable
ALTER PROCEDURE [dbo].[SP_on_TblClients]
(
@Action varchar(50),
@ClientID bigint=0,
@CFName varchar(50)=null,
@CMName varchar(50)=null,
@CLName varchar(50)=null,
@CMobile varchar(15)=null,
@CMobile2 varchar(15)=null,
@CEMail1 varchar(50)=null,
@CEMail2 varchar(50)=null,
@SoftwareID bigint=0,
@CRemarks varchar(MAX)=null,
@CRemarks1 varchar(MAX)=null,
@CRequirement varchar(MAX)=null,
@SelectTp varchar(50)=null,
@successstatus int out
)
As
begin transaction
if @Action ='select'
begin
IF @SelectTp='all'
begin
Select ROW_NUMBER() over(ORDER BY CFName) As SrNo, [ClientID],
[CFName],
[CMName],
[CLName],
[CMobile],
[CMobile2],
[CEMail1],
[CEMail2],
[SoftwareID],
[CRemarks],
[CRemarks1],
[CRequirement] from [TblClients]
end
else
begin
Select ROW_NUMBER() over(ORDER BY CFName) As SrNo, [ClientID],
[CFName],
[CMName],
[CLName],
[CMobile],
[CMobile2],
[CEMail1],
[CEMail2],
[SoftwareID],
[CRemarks],
[CRemarks1],
[CRequirement] from [TblClients] Where ClientID=@ClientID
end
end
else if @Action ='update'
begin
Update [TblClients] set
CFName = @CFName,
CMName = @CMName,
CLName = @CLName,
CMobile = @CMobile,
CMobile2 = @CMobile2,
CEMail1 = @CEMail1,
CEMail2 = @CEMail2,
SoftwareID = @SoftwareID,
CRemarks1 = @CRemarks1,
CRemarks = @CRemarks,
CRequirement = @CRequirement
Where ClientID = @ClientID
end
else if @Action ='delete'
begin
Delete FROM [TblClients]
Where ClientID = @ClientID
end
else if @Action ='insert'
begin
Insert Into [TblClients] (
CFName,
CMName,
CLName,
CMobile,
CMobile2,
CEMail1,
CEMail2,
SoftwareID,
CRemarks,
CRemarks1,
CRequirement) Values (
@CFName,
@CMName,
@CLName,
@CMobile,
@CMobile2,
@CEMail1,
@CEMail2,
@SoftwareID,
@CRemarks,
@CRemarks1,
@CRequirement)
select SCOPE_IDENTITY()
end
SELECT @successstatus =@@ERROR;
if(@successstatus = 0)
begin
commit
end
else
begin
rollback
end
GO