Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem passing parameter for stored procedure in entity
Message
 
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01517881
Message ID:
01517886
Views:
35
Change your SP this way:
ALTER PROCEDURE [dbo].[SUBSTANCESelectBySubGroupFK]
(
	@GROUP_ID int = NULL -- optional parameter
)
AS
	SET NOCOUNT ON;
                  IF @Gropu_ID IS NOT NULL
	SELECT [COMPANY_ID],
		[CRE_DATE],
		[CRE_USER],
		[GROUP_ID],
		[MOD_DATE],
		[MOD_USER],
		[SUBSTANCE],
		[SUBSTANCE_ID] 
	FROM [dbo].[SUBSTANCE]
	WHERE 
		([GROUP_ID] = @GROUP_ID)
ELSE

	SELECT [COMPANY_ID],
		[CRE_DATE],
		[CRE_USER],
		[GROUP_ID],
		[MOD_DATE],
		[MOD_USER],
		[SUBSTANCE],
		[SUBSTANCE_ID] 
	FROM [dbo].[SUBSTANCE]
	WHERE 1=0 -- Empty result
>Hi all,
>
>I have a problem with VS 2005 and MM .NET regarding a stored procedure. I've added the code to the responsible entity, but somehow I always get the following error:
>
>Procedure or function 'SUBSTANCESelectBySubGroupFK' expects parameter '@GROUP_ID', which was not supplied.
>
>Here is the code in my entity:
>
>        public mmBindingList<SUBSTANCEEntity> GetSubsBySubGroupFK(int? groupID)
>        {
>            mmBindingList<SUBSTANCEEntity> SubsList;
>
>            if (groupID != null)
>            {
>                SubsList = this.GetEntityList("SUBSTANCESelectBySubGroupFK");
>                    this.CreateParameter("@GROUP_ID", groupID);
>            }
>            else
>            {
>                this.GetEmptyDataSet();
>                SubsList = new mmBindingList<SUBSTANCEEntity>();
>            }
>            return SubsList;
>            //return null;
>        }
>
>
>And here is the stored procedure:
>
>set ANSI_NULLS ON
>set QUOTED_IDENTIFIER ON
>GO
>
>
>ALTER PROCEDURE [dbo].[SUBSTANCESelectBySubGroupFK]
>(
>	@GROUP_ID int
>)
>AS
>	SET NOCOUNT ON;
>	SELECT [COMPANY_ID],
>		[CRE_DATE],
>		[CRE_USER],
>		[GROUP_ID],
>		[MOD_DATE],
>		[MOD_USER],
>		[SUBSTANCE],
>		[SUBSTANCE_ID] 
>	FROM [dbo].[SUBSTANCE]
>	WHERE 
>		([GROUP_ID] = @GROUP_ID)
>
>
>Am I missing something? It works just fine with anothere entity/stored procedure, which is pretty similar to that. The parameter is not empty, but somehow it does not get passed on to the stored procedure.
>Thanks!
>Michael
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform