how to convert Devart.Data.Linq.Table to System.Data.DataTable

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Marsh
Posts: 3
Joined: Fri 12 Dec 2014 02:12

how to convert Devart.Data.Linq.Table to System.Data.DataTable

Post by Marsh » Wed 17 Dec 2014 07:36

I wonder how to convert Devart.Data.Linq.Table to System.Data.DataTable.
I have Devart.Data.Linq.DataContext which I got from LinqConnect Migration Wizard.

MyDataContext.MyTables returns Devart.Data.Linq.Table<Table> and I want to convert this to DataTable. Could you help me?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: how to convert Devart.Data.Linq.Table to System.Data.DataTable

Post by MariiaI » Thu 18 Dec 2014 10:28

Unfortunately, it can't be done with LinqConnect.
Please describe the scenario you are implementing and tell us, why you want to convert Devart.Data.Linq.Table to System.Data.DataTable.
In fact, you can run SQL command via plain ADO.NET to get a System.Data.DataTable as a result.

Marsh
Posts: 3
Joined: Fri 12 Dec 2014 02:12

Re: how to convert Devart.Data.Linq.Table to System.Data.DataTable

Post by Marsh » Fri 19 Dec 2014 00:51

Because I need DataTable to pass to other methods and I want to unify database usage to DataContext. I don't want to make separate codes for database connection.

I saw articles about converting IQueryable to DataTable. Isn't there any workaround to convert Devart.Data.Linq.Table to System.Data.DataTable?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: how to convert Devart.Data.Linq.Table to System.Data.DataTable

Post by MariiaI » Fri 19 Dec 2014 10:20

In fact, this is not a LinqConnect specific question. However, you are right, there are some articles about converting IQueryable to DataTable, for example, this one: http://forums.asp.net/t/1806946.aspx?Co ... +Datatable

We have prepared a test project based on this article and sent you to the e-mail address you have provided in your forum profile. Please check that the letter is not blocked by your mail filter.
Please tell us if this helps.

Post Reply