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

Error using Stored Procedure as source which contains a left or substring command

1 Answer 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 13 Jan 2016, 01:58 PM
Hi,
 I'm using for the Grid a stored Procedure with a parameter as the source.
This stored Procedure works fine. but when i open the "configuration wizard" and i insert the value in context window "Refresh data source schema" i'm getting the error "unable to receive schema. ensure that the Connection string and Selectcommand property are valid. invalid length parameter passed to the LEFT or SUBSTRING function" 
When i run the page it woks fine! in case that i need to configure a hierarchical grid i like to open the wizard where i get the error :-(
this is my code:

 aspx page:
***********************************************
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    
    <div>
    </div>
    <div class="demo-container no-bg">
    </div>
        <div id="AlertDIV" runat="server" class="AlertBOX">
        <table>
            <tr>
                <td>
                    <asp:SqlDataSource ID="mnv" runat="server" ConnectionString="<%$ ConnectionStrings:connBTDashboard %>" SelectCommand="sp_Playground" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="1" Name="dfg" Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="mnv" GroupPanelPosition="Top">
                        <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                        <MasterTableView DataSourceID="mnv">
                        </MasterTableView>
                    </telerik:RadGrid>
                </td>
            </tr>
        </table>
            </div>
    </form>
</body>
</html>
***********************************************
 ALTER proc [dbo].[sp_Playground]
@dfg int 
as

Declare @Cols varchar(max)= ''

DECLARE @SQL varchar(max)

select @Cols += '['+ [col_Name]+'],'from [dbo].[tbl_Conf_MultiNAV] where col_Group = @dfg

Set @COLS = left(@COLS,len(@COLS)-1)

select @Cols as Value 



--********************************
--call of SP in Management Studio => works fine 
--********************************
exec [sp_Playground] 1 


as a remark ... this code in my test to rebuild this error i have in another project  ;-) 

i'm using .net 4.0 and  UI Version 2015.3.1111.40 


 does anybody had that problem already ?     

thanks a lot 
cheers
Dennis 




1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 18 Jan 2016, 12:48 PM
Hi,

Can you please elaborate a bit more on how exactly the issue can be replicated? Are you using the RadGrid designer for entering the parameter? Providing step by step instructions for replicating the issue will help us investigate the problem locally and advise you further.

Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Dennis
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or