Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem passing parameter for stored procedure in entity
Message
From
11/07/2011 14:17:15
 
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01517881
Message ID:
01517883
Views:
34
That should be ok. This is similar to the MM .NET example provided in the evaluation copy:
/// <summary>
/// Returns all Order Detail for the specified Order ID
/// </summary>
/// <param name="orderID">Order ID</param>
/// <returns>Strongly typed list of OrderDetail entity objects</returns>
public mmBindingList<OrderDetailEntity> GetOrderDetail(int? orderID)
{
   mmBindingList<OrderDetailEntity> OrderDetailList;

   if (orderID != null)
   {
     OrderDetailList = this.GetEntityList("GetOrderDetailByOrderID",
       this.CreateParameter("@OrderID", orderID));
   }
   else
   {   
     this.GetEmptyDataSet();
     OrderDetailList = new mmBindingList<OrderDetailEntity>();
   }
   return OrderDetailList;
}

/// <summary>
/// Parent Retrieved hook method
/// </summary>
/// <param name="bizObj">Parent business object</param>
/// <param name="e">EventArgs</param>
protected override void HookParentRetrieved(mmBusinessObject bizObj, mmBusinessStateChangeEventArgs e)
{
   this.GetOrderDetail((int?)e.PrimaryKeyValue);
}

...
>>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
>
>I don't know the classes involved but it looks as if you are attempting to populate SubsList before setting the parameter ?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform