![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 154
Rep Power: 3
![]() |
datatable
so I have created a datatable in C#...
and i have used dataview.findrows() method to find rows that have say column3 entry equal to "s"... now I have all the rows that fit that criteria... now among those rows, i want to compare column4, column5, column6, column8 of these rows with an array of 4 words to see if any of those columns equal any of those words in the array.... now how do I do it? I mean do I do it all manually? or are there any sophisticated ways to do it? |
|
|
|
|
|
#2 |
|
Man Bear Pig Hunter
Join Date: Jul 2005
Location: NorCal, USA
Posts: 295
Rep Power: 4
![]() |
Maybe it is because it is 3am when I'm reading this, but could you try to make your question a little clearer?
__________________
People who click "images" that end with .exe shouldn't have computers. |
|
|
|
|
|
#3 | |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 154
Rep Power: 3
![]() |
Quote:
lol but let me try again... I have a datatable in C#.... you know findrows method? it returned me multiple rows which fit a criteria (say the criteria was column3 = "sk") ... now I have all the rows from the datatable that have column3 = "sk". Now I dont have a problem doing this so far. The problem arrives at next step.... now i have 4 strings (maybe stored in an array)... now I want to see whether any of these 4 strings match any of the strings stored in column4, column5, column6, column7 of the rows found using findrows method does the question make more sense now? |
|
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Mar 2005
Posts: 223
Rep Power: 4
![]() |
Could you recurse the rows you found looking in each row for the string(s)?
|
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 154
Rep Power: 3
![]() |
|
|
|
|
|
|
#6 |
|
Hobbyist Programmer
Join Date: Mar 2005
Posts: 223
Rep Power: 4
![]() |
Okay, all in theory (not bothered to check this exactly) but...
findrows() returns a DataRowView (from what I can tell) so from that you could use something like (grammer is almost certainly wrong, because I'm putting it in pseudo code, not real C# code) foreach Row in DataRowView
{
if Row["column1"] = WordArray[0]
{
do something
}
if Row["column2"] = WordArray[1]
{
do something else
}
...
} |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| DataGrid | paulchwd | C# | 12 | May 28th, 2007 8:55 AM |
| DropDownList in DataGrid not working! | wright45 | ASP | 1 | Jun 19th, 2005 11:46 AM |
| Another random question, DataTable vs Array(s) | Arla | C# | 1 | Apr 26th, 2005 8:10 PM |