This is a migrated thread and some comments may be shown as answers.

Scheduler execute_sql passing incorrect syntax

2 Answers 80 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
zx10r
Top achievements
Rank 1
zx10r asked on 06 Apr 2017, 04:03 AM

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 Answers, 1 is accepted

Sort by
0
zx10r
Top achievements
Rank 1
answered on 08 Apr 2017, 09:37 PM
The issue was not specifying using the stored procedure statement type inside the data source.
0
Eyup
Telerik team
answered on 11 Apr 2017, 07:50 AM
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.
Tags
Scheduler
Asked by
zx10r
Top achievements
Rank 1
Answers by
zx10r
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or