Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 10th, 2007, 3:16 AM   #1
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
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?
programmingnoob is offline   Reply With Quote
Old Aug 10th, 2007, 5:48 AM   #2
Ghost
Man Bear Pig Hunter
 
Ghost's Avatar
 
Join Date: Jul 2005
Location: NorCal, USA
Posts: 295
Rep Power: 4 Ghost is on a distinguished road
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.
Ghost is offline   Reply With Quote
Old Aug 10th, 2007, 12:56 PM   #3
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
Quote:
Originally Posted by Ghost View Post
Maybe it is because it is 3am when I'm reading this, but could you try to make your question a little clearer?
or maybe it's because I wrote that question at 3 AM myself
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?
programmingnoob is offline   Reply With Quote
Old Aug 10th, 2007, 2:30 PM   #4
Arla
Hobbyist Programmer
 
Join Date: Mar 2005
Posts: 223
Rep Power: 4 Arla is on a distinguished road
Could you recurse the rows you found looking in each row for the string(s)?
Arla is offline   Reply With Quote
Old Aug 10th, 2007, 2:57 PM   #5
programmingnoob
Hobbyist Programmer
 
Join Date: Feb 2006
Posts: 154
Rep Power: 3 programmingnoob is on a distinguished road
Quote:
Originally Posted by Arla View Post
Could you recurse the rows you found looking in each row for the string(s)?
could you elaborate please?
programmingnoob is offline   Reply With Quote
Old Aug 13th, 2007, 1:27 PM   #6
Arla
Hobbyist Programmer
 
Join Date: Mar 2005
Posts: 223
Rep Power: 4 Arla is on a distinguished road
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
  }
  ...
}
Arla is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:41 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC