473,320 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to compare a row and column in a datagrid in asp.net using c#?

Hi Frnz,

I have 2 datsets named ds and ds1 and merged that datasets into a single table named dt. Now, i want to compare the first dataset row value with second dataset column values For Ex: 1 dataset row contains the value as "SriDevi" means, i want to compare and find how many times the value "SriDevi" appears in second dataset columns and count the appearance. And give the answer as the "count". The answer is displayed in First Dataset. How?

Anyone please help me!!!!

Code:
Expand|Select|Wrap|Line Numbers
  1.             int rowcount;
  2.             DataRow dr = dt.Rows[0];
  3.             for (int j = 1; j < dt.Rows.Count; j++)
  4.             {
  5.                 if (ds.Tables[0].Rows[0][1].ToString() == ds1.Tables[0].Rows[j][4].ToString())
  6.                 {
  7.                     rowcount = ds1.Tables[0].Rows.Count;
  8.                     dr["Attendees"] = rowcount;
  9.                 }
  10.             }
Thanks,
Sri Devi S
Oct 8 '10 #1
1 2037
Frinavale
9,735 Expert Mod 8TB
You should be able to use the DataTable.Select method to achieve what you are looking to do.

-Frinny
Oct 8 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Marlene Harkcom | last post by:
I've got a datagrid with 5 bound columns in it as well as an edit/update/cancel column. I'm binding this to a dataset. One of the fields is always going to be one of three values. I want the...
2
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
0
by: Mark Jones | last post by:
I'm trying to delete a row from a DataGrid using a ButtonColumn with CommandName="Delete" by deleting the row in the underlying DataTable datasource, but it doesn't seem to be working at the...
2
by: news | last post by:
hi im new in the .net environnement i have a work to do in school im able to display a datagrid using a database in access and im also able to display a datagrid using a database in foxpro 8.0...
5
by: Lars Netzel | last post by:
Is it possible to asign a default value to a cell in a DataGrid column when using TableStyle as well? I have an ID column with a width= 0 that has to have a default ID value when the user adds...
0
by: Venkatesh M. | last post by:
Hi, Please help me. I need to know how to bind data to a Datagrid using Ajax. I know how to get DataSet using Ajax. Please help me. Don't use MagicAjax where some features are not supported in...
3
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If...
0
by: Sujay Sil | last post by:
hi, i would like to know how to validate a cell value in a datagrid using c#. Suppose i have three cells in a datagrid and i want the second cell to be validated. If the value is incorrect as...
2
seshu
by: seshu | last post by:
Hi Everybody I have a piece of code to compare two documents using vb.net but the problem here is it is comparing the whloe sentence but not word by word how to compare word by...
5
by: Kolags | last post by:
Hi all, Please give me guidance to complete this task. As per my requirement, I want to place data in to different textboxes whatever I selected from datagrid using edit command name. Means I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.