Thursday, April 20, 2006

Microsift Enterprise Library : Data Access Block

Following is a simple stored procedure written in PL/SQL.

( customer_Id IN NUMBER ,cur_out OUT sys_refcursor )
AS
BEGIN
OPEN cur_out FOR
SELECT NVL(X,' '),NVL(Y,' '),Z FROM ABC WHERE CUSTOMER_ID = customer_Id;
END sp_XYZ;


And following code was used to execute the above SP.

database = DatabaseFactory.CreateDatabase("CRM.Transactional");
command=database.GetStoredProcCommandWrapper("SP_XYZ");
command.AddInParameter("customer_Id",System.Data.DbType.Int32,customerId);
reader = database.ExecuteReader(command);


But.. this didn't give me the expected results. It simply returned all the records in the table ABC, irrespective of the customer_id supplied.

Since I had a similar issue regarding the sys_refcursor, to resolve this one, it didn't take that much of time. I simply changed the customer_Id input paramater to customerId [No underscore]. It worked fine, as expected and it seems that Microsift Enterprise Library : Data Access Block having an issue resolving underscores in it's input parameters.

No comments:

Post a Comment