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

DataTable instead of array of anonymous data

16 Answers 174 Views
Feature Requests
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
tmlipinski
Top achievements
Rank 1
tmlipinski asked on 03 Mar 2009, 03:56 PM
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

16 Answers, 1 is accepted

Sort by
0
Dimitar Kapitanov
Telerik team
answered on 05 Mar 2009, 12:32 PM
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.
0
tmlipinski
Top achievements
Rank 1
answered on 05 Mar 2009, 12:59 PM
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
0
tmlipinski
Top achievements
Rank 1
answered on 16 Nov 2009, 09:02 AM
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).
0
Dimitar Kapitanov
Telerik team
answered on 19 Nov 2009, 07:14 AM
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.
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 07 Dec 2009, 11:17 AM
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)
0
Dimitar Kapitanov
Telerik team
answered on 07 Dec 2009, 12:11 PM
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.
0
Tomasz M.Lipiński
Top achievements
Rank 1
answered on 09 Apr 2010, 10:39 PM
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
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 09 Apr 2010, 11:01 PM
Did it used to be in PITS?
0
Tomasz M.Lipiński
Top achievements
Rank 1
answered on 09 Apr 2010, 11:13 PM
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
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 09 Apr 2010, 11:18 PM
Yeah I don't get PITS...it should be renamed to WhatWeWantToInclude or BugsWeDecideToShow
0
Zoran
Telerik team
answered on 14 Apr 2010, 05:29 PM
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.
0
Olivier
Top achievements
Rank 2
answered on 11 Feb 2015, 03:29 PM
Hello,

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

thanks
Olivier,
0
Olivier
Top achievements
Rank 2
answered on 12 Feb 2015, 03:02 PM
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
0
Doroteya
Telerik team
answered on 16 Feb 2015, 12:23 PM
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.
 
0
Olivier
Top achievements
Rank 2
answered on 16 Feb 2015, 09:38 PM
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,
0
Doroteya
Telerik team
answered on 19 Feb 2015, 11:36 AM
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.
 
Tags
Feature Requests
Asked by
tmlipinski
Top achievements
Rank 1
Answers by
Dimitar Kapitanov
Telerik team
tmlipinski
Top achievements
Rank 1
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Tomasz M.Lipiński
Top achievements
Rank 1
Zoran
Telerik team
Olivier
Top achievements
Rank 2
Doroteya
Telerik team
Share this question
or