how to query a dataset or datatable with a sql-query?

  • Thread starter Thread starter Glenn Nilsson
  • Start date Start date
G

Glenn Nilsson

is there any way to make that possible?

i have search on google and only found answers suggesting to use
rowfilter on a view or similar, but if I would like a complex
sql-statement with GROUP BY and some SUMs and such, is that possible
with a filter?

there must be some way to use SQL for this? it seems absurd otherwise.

the reason for this is that there _is_ no database in my case, the
datatable i have is populated manually. and i would like to be able to
extract data from it.

/glenn
 
Can you explain in more detail about this question? Do you want to export
the data from a dataset programmatically? If so, the dataset object has
method to export the data with XML format.

Can you explain the reason that you want to use sql query?

Sincerely,

Kevin
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! - www.microsoft.com/security

--------------------
| Date: Thu, 09 Oct 2003 03:11:08 +0200
| From: Glenn Nilsson <[email protected]>
| User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5)
Gecko/20030924 Thunderbird/0.3
| X-Accept-Language: en-us, en
| MIME-Version: 1.0
| Subject: how to query a dataset or datatable with a sql-query?
| Content-Type: text/plain; charset=us-ascii; format=flowed
| Content-Transfer-Encoding: 7bit
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: h155n1fls27o1061.bredband.comhem.se 81.224.84.155
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63261
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| is there any way to make that possible?
|
| i have search on google and only found answers suggesting to use
| rowfilter on a view or similar, but if I would like a complex
| sql-statement with GROUP BY and some SUMs and such, is that possible
| with a filter?
|
| there must be some way to use SQL for this? it seems absurd otherwise.
|
| the reason for this is that there _is_ no database in my case, the
| datatable i have is populated manually. and i would like to be able to
| extract data from it.
|
| /glenn
|
| --
| http://wailqill.com/
|
|
 
i have thousands of rows of data (manually read, and put into a
DataTable by extracting data from logfiles).

What I want is that I would be able to extract data from it, and show
statistics out of that data, how many of this, and how many of that
between this and that time etc etc.

so, what i have is a datatable, and what I want is to be able to query
it for data, just like for instance this SQL would do:

SELECT type, SUM(type) FROM tbl GROUP BY type

note that i havent played around with sql in a year or so so the above
might be wrong, but i want to get how many different "type"s exists.

maybe a dataview is what i need, it's just that it seems very "clumsy"
way to do it, if the query gets more complicated than one simple criteria.

so no, i didn't want to extract it to xml, even though that is tempting
since then i have xpath to play around with. :)

i hope this information suffices.

thanks!
 
maybe it's just that i don't know enough about how ado.net works. and
the exakt reason for me to use SQL query is that it's what i've always
used in all other languages, and it's what is used to populate a
datatable/set from the beginning when extracting data from a database.

another thing I would like to be able to is to use a SELECT DISTINCT
equivalent on a datatable/set
 
May want to look at DataColumn.Expression too if you want to do calculations
on the client


Glenn Nilsson said:
i have thousands of rows of data (manually read, and put into a
DataTable by extracting data from logfiles).

What I want is that I would be able to extract data from it, and show
statistics out of that data, how many of this, and how many of that
between this and that time etc etc.

so, what i have is a datatable, and what I want is to be able to query
it for data, just like for instance this SQL would do:

SELECT type, SUM(type) FROM tbl GROUP BY type

note that i havent played around with sql in a year or so so the above
might be wrong, but i want to get how many different "type"s exists.

maybe a dataview is what i need, it's just that it seems very "clumsy"
way to do it, if the query gets more complicated than one simple criteria.

so no, i didn't want to extract it to xml, even though that is tempting
since then i have xpath to play around with. :)

i hope this information suffices.

thanks!
exportrights.microsoft.public.dotnet.framework.adonet:63261
 
Back
Top