Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Document Type View modes: 
User avatar
Member
Member
qqayumi-qq - 7/6/2011 10:26:27 PM
   
Document Type
Hello,

I would like to create a stored procedure with parameters. So I created my own stored procedure in my database inside <my_database>/Programmability/Stored Procedures.

After that I create a new query inside CMS Site Manager -> Document Types -> Queries
with calling the stored procedure name.

My question is how can I pass the parameters from repeater to that query? I had tried without parameters and it's working but not with parameters.

Thanks.

User avatar
Member
Member
kentico_michal - 7/7/2011 2:43:16 AM
   
RE:Document Type
Hello,

You can create a store procedure in your database within: <your_database>/Programmability/Stored Procedures. To pass a parameter you need to place parameters to the array. An example for calling parameter could be this:


object[,] parameters = new object[1, 3];
parameters[0, 0] = "@SiteID";
parameters[0, 1] = "2";

//execute stored procedure
DataSet ds = gn.ExecuteQuery("Proc_CMS_Site_Select", parameters, CMS.IDataConnectionLibrary.QueryTypeEnum.StoredProcedure, false););


Then you would receive DataSet object and you can databind the DataSet to any listing web part like for example repeater web part.

If you do not need to execute stored procedure with some parameters you can create query in CMS Site Manager and set Query type: to Stored procedure. Query text should contain only stored procedure name, nothing else. If you do not need to use parameters in the stored procedure you can simply use query repeater and specify the query name which executes the stored procedure without parameters.

Best regards,
Michal Legen