473,499 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

query against DataRow - DataTable

is it possible to run a SELECT statement against a datatable, and if so how?
this is what i have, its populating an excel document, I have my dataset,
creatig a data table, now i need to group the data from the data set so i
see the data like this: I looked at using a hashtable and for what i need it
won't work correctly
Delaware Dover
Wilmington
New Castle

New York New York City
Fishkill
Watertown

this is how it currenlty looks;
State City
Delaware Dover
Delaware Wilimington
Delaware New Castle
New York New York City
New York Fishkill
New York Watertown


foreach (System.Data.DataTable dt in ds.Tables )
{
foreach ( DataRow row in dt.Rows )
{
count++;
currentCell = (Excel.Range)cellRangeDetails.Cells[location, i+1];
currentCell.Value2 = row[""Car_Make].ToString();
currentCell.HorizontalAlignment = Excel.XlVAlign.xlVAlignJustify;
location+= 1;
}
}

Nov 17 '05 #1
1 2368
yes ,it is possible to run a SELECT statement against a datatable
For querying data in a DataTable,
you have
DataTable.Select //this is not a sql command.
DataTable.Rows.Find

"microsoft.news.com" wrote:
is it possible to run a SELECT statement against a datatable, and if so how?
this is what i have, its populating an excel document, I have my dataset,
creatig a data table, now i need to group the data from the data set so i
see the data like this: I looked at using a hashtable and for what i need it
won't work correctly
Delaware Dover
Wilmington
New Castle

New York New York City
Fishkill
Watertown

this is how it currenlty looks;
State City
Delaware Dover
Delaware Wilimington
Delaware New Castle
New York New York City
New York Fishkill
New York Watertown


foreach (System.Data.DataTable dt in ds.Tables )
{
foreach ( DataRow row in dt.Rows )
{
count++;
currentCell = (Excel.Range)cellRangeDetails.Cells[location, i+1];
currentCell.Value2 = row[""Car_Make].ToString();
currentCell.HorizontalAlignment = Excel.XlVAlign.xlVAlignJustify;
location+= 1;
}
}

Nov 17 '05 #2

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

Similar topics

2
4833
by: Andrew Mueller | last post by:
Hello, Since I cannot query a DataSet directly, and I would like to maintain it's data, how would I use an adapter (SqlDataAdapter or DataAdapter) to query this DataSet. Example: Could I? ...
6
4288
by: goodstart123 | last post by:
For example, the following code works fine without SqlConnection. Any Answer to the question? string connectionString = "server=YourServer; uid=sa; pwd=YourPassword;...
4
2917
by: Jim in Arizona | last post by:
Continuing my lessons out of a book, I ran into a problem when trying for the first time to update a datastore (access database in this case). My Code: Private Sub Page_Load(ByVal sender As...
5
12358
by: Terry Olsen | last post by:
I have an in-memory DataTable with about 35,000 rows. I have an IP address column that is populated and a hostname column that is not. I want to be able to quickly update the hostname column so...
8
2986
by: Jim in Arizona | last post by:
I've been using an example out of a book to be able to edit the rows in a database. I am getting the following error: ========================================================...
5
11626
by: samoore33 | last post by:
I use the code below to search through a DataSet: Dim t As DataTable t = result.Tables("State") Dim strExpr As String strExpr = "id = '" & theState.ToString() & "'" Dim foundRows() As DataRow...
6
28292
by: Pete Wittig | last post by:
Hi, I have a DataTable and I want to get a subset of the rows within it. I use the Select method to get my subset and the results are in a DataRow. I want to put those Rows back into a...
2
17626
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
How can I run this query against a table in my Access database? I don't know hwo to use it in C#. In VB I would use .Recordset = "some sql statement". How do I do this in C#? //I get a vlaue...
3
2080
by: Oenone | last post by:
I have a project that creates a SqlDataAdapter and uses its Fill method to fill a DataTable with data from a user-provided query. From there I can obviously access details about the rows and...
0
7132
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7178
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7223
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...
1
6899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5475
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.