Hello,
I have a dataview that contains about 300k records with 3 cols (read
in from a directory). I need to get the count of rows by col1 and col2
(grouping by col1 and col2). What would be the best way to do it?
Currently, I am sorting them and reading each row and comparing
current row's col1 and col2 with previous row's col1 and col2 and
keeping the total in an arraylist. But this is very slow; I am pretty
new to C#, any help is appreciated.
Thanks. 4 25000
Hello,
Unfortunately, you have said nothing about the source of the data. If this
is some kind of database, it would be much better to perform the grouping by
using the database means, such as 'GROUP BY' SQL clause.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"luke" <lu*****@yahoo. com> wrote in message
news:87******** *************** ***@posting.goo gle.com... Hello, I have a dataview that contains about 300k records with 3 cols (read in from a directory). I need to get the count of rows by col1 and col2 (grouping by col1 and col2). What would be the best way to do it? Currently, I am sorting them and reading each row and comparing current row's col1 and col2 with previous row's col1 and col2 and keeping the total in an arraylist. But this is very slow; I am pretty new to C#, any help is appreciated.
Thanks.
Hi luke,
AFAIK this is the only way.
--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com www.rthand.com
"luke" <lu*****@yahoo. com> wrote in message
news:87******** *************** ***@posting.goo gle.com... Hello, I have a dataview that contains about 300k records with 3 cols (read in from a directory). I need to get the count of rows by col1 and col2 (grouping by col1 and col2). What would be the best way to do it? Currently, I am sorting them and reading each row and comparing current row's col1 and col2 with previous row's col1 and col2 and keeping the total in an arraylist. But this is very slow; I am pretty new to C#, any help is appreciated.
Thanks.
I am rading in filenames from a folder and filling a table out of
their parsed name. Eg, abcde.txt would be put into table where 'a' is
a column, so as b,c,d and e. Now, I need to know how many files that
match columna and columnc exist and get their total. I hope I am being
clear ...
Thanks.
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote in message news:<uo******* *******@TK2MSFT NGP09.phx.gbl>. .. Hello,
Unfortunately, you have said nothing about the source of the data. If this is some kind of database, it would be much better to perform the grouping by using the database means, such as 'GROUP BY' SQL clause.
-- Dmitriy Lapshin [C# / .NET MVP] X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx Bring the power of unit testing to VS .NET IDE
"luke" <lu*****@yahoo. com> wrote in message news:87******** *************** ***@posting.goo gle.com... Hello, I have a dataview that contains about 300k records with 3 cols (read in from a directory). I need to get the count of rows by col1 and col2 (grouping by col1 and col2). What would be the best way to do it? Currently, I am sorting them and reading each row and comparing current row's col1 and col2 with previous row's col1 and col2 and keeping the total in an arraylist. But this is very slow; I am pretty new to C#, any help is appreciated.
Thanks.
Luke, I hope I am being clear ...
Not really, are you saying you are parsing each position of the name into a
distinct DataTable column? You do realize that file names can be upto 256
characters so you would need 256 columns?
I would consider defining "parent" tables for your grouping (one for each
grouping), then as I am adding rows to the first DataTable, update the
"parent" datatable with new values. I would also define relationships
between these datatables, so I could use the DataRow.GetChil dRows method...
DataTables:
G1 : c1
G2 : c1, c2
G3 : c1, c2, c3
D : c1, c2, c3, c4
c1, c2, c3 & c4 are columns, while G1, G2, & G3 are my grouping tables, & D
is your existing DataTable.
Hope this helps
Jay
"luke" <lu*****@yahoo. com> wrote in message
news:87******** *************** **@posting.goog le.com... I am rading in filenames from a folder and filling a table out of their parsed name. Eg, abcde.txt would be put into table where 'a' is a column, so as b,c,d and e. Now, I need to know how many files that match columna and columnc exist and get their total. I hope I am being clear ...
Thanks. "Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:<uo******* *******@TK2MSFT NGP09.phx.gbl>. .. Hello,
Unfortunately, you have said nothing about the source of the data. If
this is some kind of database, it would be much better to perform the
grouping by using the database means, such as 'GROUP BY' SQL clause.
-- Dmitriy Lapshin [C# / .NET MVP] X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx Bring the power of unit testing to VS .NET IDE
"luke" <lu*****@yahoo. com> wrote in message news:87******** *************** ***@posting.goo gle.com... Hello, I have a dataview that contains about 300k records with 3 cols (read in from a directory). I need to get the count of rows by col1 and col2 (grouping by col1 and col2). What would be the best way to do it? Currently, I am sorting them and reading each row and comparing current row's col1 and col2 with previous row's col1 and col2 and keeping the total in an arraylist. But this is very slow; I am pretty new to C#, any help is appreciated.
Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: RPI_alum |
last post by:
I've been experiencing some frustrating behavior that I believe may be a MS bug in the Framework. Has anyone else experienced this, know a better way to resolve it, or if it is an actual MS bug
*) I have a DataSet containing 2 tables, A and B
*) There is a 1-to-1 relation between the tables with table A being the parent. (ABrel
*) A DataView is created on table A to allow filtering of the result se
*) 2 Text Boxes are created and Bound...
|
by: Amadelle |
last post by:
Hi All and thanks in advance,
I was wondering what is the best way of grouping data in a dataset. Like
using a "Group By" clause in Sql statements. I was thinking of using XML
but I don't even know how to do grouping in XML.
I have a dataset table which i would like to supposedly run the following
sql statement on:
Select UserID from tblAccounts
|
by: Alpha |
last post by:
I have a window application. In one of the form, a datagrid has a dataview
as its datasource. Initial filtering result would give the datavew 3 items.
When I double click on the datagrid to edit the selected lie item at which
case I would pop up a separate dialog box to do so, in the debugging code,
the dataview.count would return 0. I get a error message because I tried to
get values out of a dataview that holds 0 items. Does anyone...
|
by: Brent Mondoux |
last post by:
Hey everyone,
I'm trying to find the best non-spaghetti code way to do the
equivalent of a ColdFusion CFQUERY GROUP command so that I can display
a FAQ with categories as follows:
-- Example: Begin --
General
|
by: kjvt |
last post by:
Based on a prior posting, I've written a function to convert a
recordset to a dataview. The first call to the function for a given
recordset works perfectly, but the second call always returns a
dataview with a count = 0. Can someone explain why and how I might
work around this problem?
Here is the code for my function:
Public Shared Function GetViewFromRS(ByVal pRS As ADODB.Recordset) _
As DataView
| |
by: Steve |
last post by:
I have a form with a dataset and a datagrid.
I created a dataview on this dataset.
When the user modifies the datagrid, I look up this record in the dataview
to make sure it is unique.
Here is the confusion.........
I thought that the DataView is the view from the dataset, but it seems that
the dataview has the records that are in the datagrid, because everytime I
search for a record that I know is NOT in the dataset, it finds it. I...
|
by: enceladus311 |
last post by:
I'm trying to find a way to keep from having to fill a DataView after
every PostBack to a page. Basically, the design is that I have a
DataView that I fill, which I then set as the DataSource to a DataGrid
on my page. This works well, however, like I said, I would like to
keep from having to fill the DataView on each PostBack. So, naturally,
what I did was checked whether or not the request was a PostBack by
checking the IsPostBack...
|
by: frostbb |
last post by:
The following code works great in C# Net 1.0 & Net 1.1 apps ... doesn't work
for Net 2.0 apps.
Cannot get pDg.IsSelected(i) to toggle to 'true' for 'highlighted' rows in a
DataGrid control.
private int CountSelectedDataGridRows(DataGrid pDg)
{
int i = 0;
|
by: Pravin Pujari |
last post by:
Hi All,
I am using .net framework 1.1 and c#. I have one problem regarding dataview.
I have one dataview to which sorting may be applied or may not be applied. I have one UI component where I am displaying the dataview. All rows in dataview are displayed in the sequence as they appear in dataview. i.e. there is direct mapping between dataview rows and UI rows.
I have subscribed ColumnChanged event of the datatable on which dataview is...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |