Scheduler execute_sql passing incorrect syntax

3 posts, 0 answers
  1. zx10r
    zx10r avatar
    14 posts
    Member since:
    Jul 2016

    Posted 05 Apr 2017 Link to this post

    I have a scheduler setup where the datasource select command also has a control parameter being passed in from a combo box. The generated execute_sql statement does not seem to work and sql server complains about parameter not being passed in. I have tried executing the generated statement manually in sql server and the result is the same. The code is bellow:

     

    SelectCommand="EXEC Scheduler.GetAppointments" 

     <SelectParameters>
                <asp:ControlParameter ControlID="cmbProviderSort" DbType="Int32" ConvertEmptyStringToNull="true" DefaultValue="-1" 
                    PropertyName="SelectedValue" Name="a" />
            </SelectParameters>

     

    The generated statement from this is : exec sp_executesql N'EXEC Scheduler.GetAppointments',N'@a int',@a=26

    If i try and execute that statement on sql server it complains the @a parameter is not being passed.

    Thanks

  2. zx10r
    zx10r avatar
    14 posts
    Member since:
    Jul 2016

    Posted 08 Apr 2017 Link to this post

    The issue was not specifying using the stored procedure statement type inside the data source.
  3. Eyup
    Admin
    Eyup avatar
    3618 posts

    Posted 11 Apr 2017 Link to this post

    Hello,

    I am glad that you've managed to pinpoint the cause of the issue.
    Please note that this is a generic requirement not related to Telerik specifically. You can check various sources over the net about ControlParameters and Stored Procedures:
    https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.controlparameter(v=vs.110).aspx
    http://stackoverflow.com/questions/5326113/how-to-specify-parameter-value-for-stored-procedure-in-sqldatasource

    If you have any questions related to the functionality of Telerik controls, please do not hesitate to contact us.

    Regards,
    Eyup
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top