Convert sqldatasource to dataTable issues

6 posts, 0 answers
  1. Fadhli
    Fadhli avatar
    7 posts
    Member since:
    Oct 2011

    Posted 07 Dec 2011 Link to this post

    I'm trying to convert sqldatasource to dataTable but I recieved an error.

    Here is the error:
    'Telerik.Reporting.SqlDataSource' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'Telerik.Reporting.SqlDataSource' could be found (are you missing a using directive or an assembly reference?)

    DataSourceSelectArguments args = new DataSourceSelectArguments();
    DataView view = (DataView)sqlDataSource1.Select(args);
    DataTable table = view.ToTable();

    Which namespace should I use and which assembly should I add? Or maybe its not supported?

  2. Steve
    Steve avatar
    10941 posts

    Posted 12 Dec 2011 Link to this post

    Hello Fadhli,

    We would appreciate if you provide more information on your scenario - what is your data, what is your report setup, what are you trying to accomplish and where is this code invoked etc.

    the Telerik team

    Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

  3. DevCraft R3 2016 release webinar banner
  4. sulejman Vezi
    sulejman Vezi avatar
    3 posts
    Member since:
    Nov 2009

    Posted 09 Jan 2014 Link to this post


    I'm also interested in how to do this.

                DataView dv = new DataView();
                DataTable dt = new DataTable();
                dv = SQLDataSource1.Select(DataSourceSelectArguments.Empty);
                dt = dv.ToTable();

  5. Peter
    Peter avatar
    1611 posts

    Posted 10 Jan 2014 Link to this post

    Hi Suli,

    Telerik Reporting SqlDataSource component is a declarative datasource component that is used internally by the reporting engine. It can't be used to fill DataTable or DataView with data. Instead to fill your DataTable our recommendation is to use the standard .NET approach with SqlDataAdapter. For an example check out the Populate DataTable with records from database? stackoverflow article.


    New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

  6. Rahul
    Rahul avatar
    5 posts
    Member since:
    Dec 2014

    Posted 10 Aug Link to this post

    Hi All,
    I am facing same issue to sqldatasource to DataTable issues. I need this solution to fix below scenario.

    In my report I am calling stored procedure using sqldatasource1.  Let’s say Stored procedure is returning data as below.

    Column1      Column2        Column3      Column4
    RowData     RowData        RowData      RowData
    RowData     RowData        RowData      RowData

    And I am assigning those data to Report using
           this.DataSource = sqldatasource1

    The actual issue is When I export to .csv, It’s returning all the data which SP is returning. I want to remove some column based on condition before I assign to this.dataSource. In front end I am hiding unwanted column but while exporting to .csv it is exporting all the column.
    Using DataTable I can Perform this operation like DT.Column.remove(“Column1”). But I same fix is not working with sqldatasource that I can understand but I have below question.
    1 ) Is there any other way to control Data to export in .csv file(remove column from sqldatasource ). Without modify in Stored procedure.?
    2 ) If no, Then How to perform above operation using sqldatasource.?

    Is there anyone having this issue?
    Please suggest fix this issue.

    Many Thanks,
  7. Stef
    Stef avatar
    2923 posts

    Posted 12 Aug Link to this post

    Hi Rahul,

    The CSV rendering mechanism exports the report layout with data, means how data is visualized by the report - Design Considerations for CSV Rendering.

    If you want to export only data in CSV format, please consider retrieving data in code and exporting in a text file without going through a report e.g. Export Datatable to CSV Using Extension Method (external resource).

    I hope this helps.

    Telerik by Progress
    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
Back to Top
DevCraft R3 2016 release webinar banner