DataTable instead of array of anonymous data

17 posts, 0 answers
  1. tmlipinski
    tmlipinski avatar
    131 posts
    Member since:
    Dec 2006

    Posted 03 Mar 2009 Link to this post

    Hi,

    When asking for something like this:

    select x.a, x.b from xExtent as x

    we get a 2-dimensional array of values. This array is anonymous - I mean that columns have no names.
    It would be very useful to be able to get, in such a case, a DataTable with named columns: a and b

    Use case: a form for an admin, which allows him to ask his database any question. It is required that columns have meaningful names. Or any user that wants ad hoc queries.

    Regards
    Tomasz
  2. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 05 Mar 2009 Link to this post

    Hello tmlipinski,
    Thanks for the suggestion. We are also thinking in the same direction. The EntityFramework for example uses DataRecord implementations to return anonymous results. Do you think it is appropriate to have the same functionality in our product?

    Regards,
    Dimitar Kapitanov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. tmlipinski
    tmlipinski avatar
    131 posts
    Member since:
    Dec 2006

    Posted 05 Mar 2009 Link to this post

    Hi,
    I think that at a glance it doesn't matter how this functionality will be implemented. Using Microsoft's System.Data seems to be the easiest way. Do you know SOODA (Small Object-Oriented Data Access: http://sooda.sourceforge.net/)? I've used it before OpenAccess; in case of anonymous result it returns just a DataReader object and I think it's a perfect solution.

    I haven't event touched EntityFramework and I don't know what DataRecord is, so I cannot compare.

    Regards
    Tomasz
  5. tmlipinski
    tmlipinski avatar
    131 posts
    Member since:
    Dec 2006

    Posted 16 Nov 2009 Link to this post

    Hi, Telerik Team,

    How things are going on with this issue? You have stated that "We are also thinking in the same direction." Has anything changed after these 8 months?
    I'm dealing with some legacy database now, where stored procedures are used for everything. A lot of them return not objects (in ORM sense) but just sets of data - from various tables, sometimes aggregated. It is very painful to use numbers instead of names... And to assure that their order will not change...

    Regards
    Tomasz

    PS. I'm using the newest version of OA (Q3 2009).
  6. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 19 Nov 2009 Link to this post

    Hi tmlipinski,
    Unfortunately the new API slipped this release as well because we had more urgent matters to address. However my intentions are to finally deliver such an API for Q1 release in a 'set of features'  that will change Telerik OpenAccess ORM dramatically. The best thing I can do is to provide you with the earliest bits when they are available, but I don't see it earlier than late January to mid February.
    I am sorry for the inconvenience caused.

    Kind regards,
    Dimitar Kapitanov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 07 Dec 2009 Link to this post

    Can I throw in another request for this to please not miss the next release?  I'm starting to use openaccess quite a bit in my web project and this this numbered SP support is scary to work with (when I'm not the only one touching the procedures)
  8. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 07 Dec 2009 Link to this post

    Hello Steve,

    We will try our best to push it to Q1 2010 release.


    Regards,
    Dimitar Kapitanov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Tomasz M.Lipiński
    Tomasz M.Lipiński avatar
    71 posts
    Member since:
    Nov 2009

    Posted 09 Apr 2010 Link to this post

    Hi,
    As I can see this feature is not included in Q1 2010. I can't find it in the PITS site too. Is it abandoned?

    Regards
    Tomasz
  10. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 09 Apr 2010 Link to this post

    Did it used to be in PITS?
  11. Tomasz M.Lipiński
    Tomasz M.Lipiński avatar
    71 posts
    Member since:
    Nov 2009

    Posted 09 Apr 2010 Link to this post

    Hi,

    No, I think it has never been in PITS. And it is also a bad news - it may mean that Telerik doesn't work on this issue at all  - as far as I understand the role of PITS.

    Regards
    Tomasz
  12. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 09 Apr 2010 Link to this post

    Yeah I don't get PITS...it should be renamed to WhatWeWantToInclude or BugsWeDecideToShow
  13. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 14 Apr 2010 Link to this post

    Hi Steve & Tomasz,

     The functionality is not abandoned but it is really part of a much greater API that we have not yet delivered. The main reason for the postponing is that we have worked on other aspects of the product that have greater priority like the latest visual designer. This API where you will virtually be able to get a data reader out of a stored procedure as Tomasz mentioned is still a major part of our product plans but I would not promise you the delivery very soon. Few months is the best prediction I can give you at the moment.

    Best wishes,
    Zoran
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  14. Olivier
    Olivier avatar
    146 posts
    Member since:
    Nov 2010

    Posted 11 Feb 2015 Link to this post

    Hello,

    It's possible to export a Linq query or Sql statement to Datatable , please ?

    thanks
    Olivier,
  15. Olivier
    Olivier avatar
    146 posts
    Member since:
    Nov 2010

    Posted 12 Feb 2015 Link to this post

    Hello 

    I build a solution, for this question!

    public DataTable GetFillData(string cSql) {
            DataTable oDt = new DataTable();
      
            if ( ! string.IsNullOrEmpty(cSql)) {
                using ( EntitiesModel dbContext = new EntitiesModel() ) {
                    using ( IDbConnection connection = dbContext.Connection ) {
                        // 2. Create a new command.
                        using ( OACommand command = this.Connection.CreateCommand()) {
                                // 3. Set the command text.
                                command.CommandText = cSql;
                                using (OADataReader executeReader = command.ExecuteReader()) {
                                    oDt.Load(executeReader);
                                }
                                command.Parameters.Clear();
                                command.Dispose();
                            }
                        }
                        dbContext.Dispose();
                }
            } // End If Not Empty cSql
      
            return oDt;
        } // End GetFillData
  16. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 16 Feb 2015 Link to this post

    Hello Olivier,

    It seems that your question in this thread is related to the topic discussed in the Artificial Field or Anonymous Field in agregate query thread. If this is the case, let me confirm that the code from the snippet is a valid solution in your situation.

    Regarding the generating such a code with Data Access out-of-the-box, I'm afraid that this is not supported. While there was an idea in this direction, the actual implementation was postponed due to requests with a higher community approval. 

    I hope this helps. Do let us know if you need further information or assistance.


    Regards,
    Doroteya
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  17. Olivier
    Olivier avatar
    146 posts
    Member since:
    Nov 2010

    Posted 16 Feb 2015 in reply to Doroteya Link to this post

    Hello Doroteya

    this post answer for this post and the poste Articifial Field or Anonymous Field in agreagte query,
    but it's not the best, cause after get the datatable we don't save after modification.

    If you can to report , this new feature in the linq syntax ,(anonymous or type variable) , to get anonymous field without custom class.

    it' ll be a great class , if you can help us.

    thanks
    Olivier,
  18. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 19 Feb 2015 Link to this post

    Hi Olivier,

    Thank you for the feedback.

    Indeed the outlined approach does not allow you to persist any modifications to the database. The change tracking capabilities of Data Access are a feature of the persistent classes, and at the time present are not supported for anonymous or non-persistent strongly typed classes.

    Regarding your idea about enhancing the LINQ API, our current plan for Q1 2015 does not include any changes in this direction. Therefore I would suggest to you to place a feature request with a description of your scenario on our Ideas and Feedback portal. There, the Data Access community can review it and vote about it. Additionally, you will be able to track its status.

    I hope this helps. Do let us know if you need further information.


    Regards,
    Doroteya
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
Back to Top
DevCraft banner