Click here to Skip to main content
13,146,315 members (44,325 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
I have a dynamic stored procedure and use then LINQ to SQL then calss
ISingleResult
don't Generated

What I have tried:

this is a Stored Procedure :
alter  PROCEDURE	sp_selectFromTable_New @TableName [nvarchar](50)
				   ,@FieldsName [nvarchar](500)
				   ,@WhereCri [nvarchar](1000)
AS
 
	DECLARE	@SQL [nvarchar](1000) 
	set @SQL	='Select '+ @FieldsName+' from ' + @TableName	+ ' where @WhereCri_ '
 
	EXEC sp_executesql @SQL,N'@WhereCri_ nvarchar(50)',@WhereCri_=@WhereCri

and I pass it in DBml File in LINQ to SQL Class..

how can use it ?

Thank you
Best Regards
Posted 14-Sep-17 4:39am
Updated 14-Sep-17 7:24am
Comments
Karthik Bangalore 15-Sep-17 0:06am
   
check this https://stackoverflow.com/a/14200824/1147428

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

alter PROCEDURE sp_selectFromTable_New @TableName [nvarchar](50)
,@FieldsName [nvarchar](500)
,@WhereCri [nvarchar](1000)
AS

DECLARE @SQL [nvarchar](1000)
set @SQL ='Select '+ @FieldsName+' from ' + @TableName + ' where ' + @WhereCri

EXEC sp_executesql @SQL
  Permalink  
Comments
ibrahim maher 14-Sep-17 17:14pm
   
where the Solution u are repeated the Question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 14 Sep 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100