By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,854 Members | 1,980 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,854 IT Pros & Developers. It's quick & easy.

query against DataRow - DataTable

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.