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

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

Postby 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?
Marsh
 
Posts: 3
Joined: Fri 12 Dec 2014 02:12

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

Postby 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.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

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

Postby 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?
Marsh
 
Posts: 3
Joined: Fri 12 Dec 2014 02:12

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

Postby 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?Convert+IQueryable+to+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.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to LinqConnect (LINQ to SQL support)