473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Linq to SQL - Return DataTable as a result of Linq query

Hi!

How to get result od dataTable from Linq query? I have typied DataSet
and I want to join couple of tables. And I have a problem with change
this result to DataTable type. (I don't want to rewrite everything in
foreach)

e.g. How can I make DataTable from it? Thx for help!

var query =
from firmy in boKontakty.DataSetKontakty.FIRMY
join kancelarie in
boKontakty.DataSetKontakty.KANCELARIE on firmy.FIRMA_O equals
kancelarie.ID into firmKan
join kategorie in
boKontakty.DataSetKontakty.KATEGORIE on firmy.KATEGORIA equals
kategorie.NAZWA into firmKanKat
select
new
{
Id = firmy.ID,
Nazwa = firmy.NAZWA,
Nazwa_pelna = firmy.NAZWA_PELNA,
Kancelaria_obslugujaca = kancelarie.NAZWA,
Kolor = kategorie.KOLOR
};
Feb 1 '08 #1
1 11165
"szwejk" <sz*****@gmail.comwrote in message
news:7b**********************************@f47g2000 hsd.googlegroups.com...
How to get result od dataTable from Linq query? I have typied DataSet
and I want to join couple of tables. And I have a problem with change
this result to DataTable type. (I don't want to rewrite everything in
foreach)
The standard libraries do not contain such a functionality, but it
shouldn't be terribly difficult to write an Extension method for
IEnumerable<Treturning a DataTable, using Reflection to enumerate the
properties of T and creating a DataTable (or filling an existing one) with
equivalent columns. Of course, the internal implementation would have to use
foreach to populate the table, but this would be invisible to you once the
extension method was created.
Feb 1 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bob Bedford | last post by:
We have no access to a mysql NG on my provider's server, so we ask here: We have a long query (long in text) with a UNION between 2 select. We have been informed that some times the query...
0
by: thorley | last post by:
Greetings, I'm now merrily on my way developing a FastCGI Server in python. Thanks to help of others on this list I've got a proof of concept up and running. Herein lies my question: My goal...
6
by: klove1209 | last post by:
Good afternoon, Can someone please tell me how I can return records from a query. I have text fields that I need to obtain, and have those necessary records sent to MS Word. I need to return the...
1
by: =?Utf-8?B?SnVhbiBQdWVibGE=?= | last post by:
Hi, I'm trying to use Linq in a webservice that returns a data from a query. As the data return from Linq to Sql is IEnumerable<Tand it's not possible to easily get a Dataset, Which is the best...
2
by: GD | last post by:
I am trying to execute a third party console application and return the result dispalayed in the console screen. Can this be achieved? Thanks. GD
0
by: Andy B | last post by:
Hi... I have this DataTable: StockContract.Dictionary. I need a linq to DataTable query that will select all rows where the "Word" column values match the WordTextBox.Text value. I am running...
2
by: timor.super | last post by:
Hi group, In my database, I have a table with fields like this : id | title | xml ------------------------------------ 1 | title1 | <datas><data><item...
0
by: Nightcrawler | last post by:
I have the following tables that I have dragged into a .dbml file (have only included the keys for simplicity). CREATE TABLE .( NOT NULL) CREATE TABLE .( NOT NULL, NOT NULL)
2
by: Swys | last post by:
Hi all! I am creating a WCF service (my first). I am going to have a variety of clients, one of which is a PHP client. Now, I've already established that I can return a normal string to the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.