Click here to Skip to main content
15,562,561 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Updated 14-Sep-17 8:24am
Comments
Karthik_Mahalingam 15-Sep-17 0:06am    
check this https://stackoverflow.com/a/14200824/1147428

1 solution

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
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900