473,325 Members | 2,771 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,325 software developers and data experts.

LINQ to SQL - Count of Columns in Result?

Hi All,

Does anyone know of a way to count the number of columnns in a
Linq2SQL result? (In this case ISingleResult).

I am building a method to get summary report data. I want to be able
to add a column to my stored procedure at some point, without amending
the clientside code where the data is displayed in a gridview,
populated from a datatable - I want to define the columns in the
datatable dynamically, looping X number of columns in the LINQ result.

Hope that makes sense!

Thanks.
Jul 29 '08 #1
1 3151
It seems to me that executing an arbitrary query where you don't know
the output schema is not the intended use-case for LINQ-to-SQL. Perhaps
just execute this via SqlCommand and your choice of SqlDataReader /
DataTable?

There is no benefit from fighting the system, just to use LINQ-to-SQL in
a case when it doesn't help you...

Marc
Jul 29 '08 #2

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

Similar topics

68
by: Martin Joergensen | last post by:
Hi, I have some files which has the following content: 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0
4
by: Arthur Dent | last post by:
Hello all, I am trying to figure out how to do something in LINQ, IF I can even do it in LINQ. Online samples and such for LINQ is still a bit on the sketchy side. Here is what I want to...
4
by: CSharper | last post by:
I would like know, will it be possible to run a linq statement generated on the fly by a program? Lets say, I have string like the following string t = "from c in doc.Decentents('Value') select...
1
by: silpa | last post by:
Hi, Suppose if there are 10 records in employee table. I have a stored procedure named GetEmpCount which returns employee count. (i.e., The answer is 10). i.e., Select count(*) from...
10
by: shapper | last post by:
Hello, I create the following Linq query to select all the tags associated to Posts: viewData.TagsPapers = (from t in database.Tags select new TagPaper { Tag = t, Count = t.PostsTags.Count...
1
by: shapper | last post by:
Hello, I have three tables with the following columns: Polls (PollID, Question) Options (OptionID, PollID, Answer) Votes (VoteID, OptionID) Then I have two wappers around Polls and Options,...
2
by: Chris | last post by:
Trying to get my head around linq. Here is what I have: Tables: OrderHeader OrderLineItem OrderSubLineItem The result set I need is: OrderHeader.Description, Count(OrderSubLineItem) as...
1
by: jbot | last post by:
I've got some pages that use linq to sql. When I look at the generated sql statements in sql server profiler, I see the same statements repeated. In the example below (from a linq data source...
2
by: Simon Woods | last post by:
Hi I am struggling to navigate an XElement and I'm not sure what is going wrong. Here's my XML via vb's xml literals Dim l_testSchema = _ <Mappings> <Definitions> <ItemGroup>...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.