How to specify the stored procedure parameters programmatically?
Last modified:
In any other version except the AQB the .NET (starting from the v.3.4 of WinForms and WPF Edition and the v.3.0 of ASP.NET Edition), use the GetProcedureParameters event to pass the parameters list as a comma-separated string.
Since the mentioned versions, use the DatasourceAdded event for this purpose. See the code sample below.
private void QueryBuilder1OnDataSourceAdded(SQLQuery sender, DataSource addedObject) { var metadataObject = addedObject.MetadataObject; if (metadataObject == null || metadataObject.Type != MetadataType.Procedure) return; using (var procedureProperties = (ProcedureProperties) PropertiesFactory.GetProperties(queryBuilder1.QueryView, addedObject)) { var parameters = procedureProperties.MetadataParameters; if (parameters.Count > 0) { // parameters list fetched from server foreach (var parameter in parameters) { procedureProperties.SetPropertyValue(parameter.Name, "100"); } } else { // parameters list is unknown procedureProperties.SetPropertyValue("Arguments", "100, Null, :p"); } } }