Click here to Skip to main content
16,005,826 members
Home / Discussions / C#
   

C#

 
Questionfind Windows Folder address Pin
Masterhame16-Mar-07 4:36
Masterhame16-Mar-07 4:36 
AnswerRe: find Windows Folder address Pin
Scott Dorman16-Mar-07 4:47
professionalScott Dorman16-Mar-07 4:47 
QuestionSum datagrid column values by criteria Pin
choopie16-Mar-07 4:18
choopie16-Mar-07 4:18 
AnswerRe: Sum datagrid column values by criteria Pin
mike montagne16-Mar-07 7:16
mike montagne16-Mar-07 7:16 
GeneralRe: Sum datagrid column values by criteria Pin
choopie17-Mar-07 9:42
choopie17-Mar-07 9:42 
GeneralRe: Sum datagrid column values by criteria Pin
mike montagne17-Mar-07 10:25
mike montagne17-Mar-07 10:25 
GeneralRe: Sum datagrid column values by criteria Pin
choopie17-Mar-07 10:46
choopie17-Mar-07 10:46 
GeneralRe: Sum datagrid column values by criteria Pin
mike montagne18-Mar-07 7:59
mike montagne18-Mar-07 7:59 
You're welcome.

Incidentally, you should understand this as a basic model for what you are trying to do:

SQL is an excellent way to eliminate the conditional logic you are going to have to perform. In other words, if your source data is organized in tables (and rarely if ever is there a good reason for such data not to be -- maybe unless it's just a few values), then you can eliminate sometimes huge bodies of code and costly processes by first applying SQL to your source data. If your SQL statement can apply all the necessary conditions to reduce/filter its result set to *just* the records/rows you should be processing, then you can even get the sum in one fell swoop.

That is the ideal approach, and you should always tackle such a problem this way (even if you didn't know SQL before).

Many years ago, I discovered this in the process of re-writing a huge client/server application. The application I had to replace had gone down. No source existed. It processed a huge number of records (programmatically), finally producing billing information related to numerous categories of property acreage, altogether assembled under each owner. The first so many acres were taxed at such and such a rate, the next so many acres (per owner, not per property) were charged at further scaled rates, etc.

The original application took 3 1/2 hours to process their tables. The process was complex, and you could understand why it might take so long, particularly as substantial engineering challenges existed to any degree of refinement.

I spent the time to develop those substantial engineering innovations, and my first stab at the process processed their data in only 11 seconds. My clients practically wept they were so ecstatic.

The innovations which made the process so fast involved developing a system which never had to look at the same data twice, and elimination of all conditional processing possible -- conditional logic was reduced to the absolute minimal process.

Nonetheless, SQL tools were relatively new then (in the first days of OOP), and I had an idea that I could re-write my process -- actually eliminate most of it -- by devising an SQL statement. A few days later I demonstrated this process. Most of my time was in developing a universal interface by which they could prescribe any conceivable tax scheme in seconds. The SQL process produced billing information -- ready to print in reports -- in only 3 seconds. Moreover, the results of the prescription could be evaluated *before* application, and could be applied in 1 second to "permanent" records. The application *still* however could be reversed (unapplied) in 1 second. True story. Eyes got wet. Heads just shook. Now, for the first time ever, they could have a board meeting and decide the tax rates necessary to cover costs in seconds.

So your process takes these things into account. What is the fastest and most convenient way to do what you have to do with the resources or tools available to you?

SQL is powerful and fast. No way can you iterate your cells and produce the answer as quickly. Way back I read a benchmark that has always stuck in my head. With this certain SQL DBMS, a Pentium 90 could process a million record table and produce a [I forget just how many] many-record result set in under a second.

Think about SQL. You will use it often if you operate on data and write efficient code.
GeneralRe: Sum datagrid column values by criteria Pin
mike montagne18-Mar-07 8:17
mike montagne18-Mar-07 8:17 
GeneralRe: Sum datagrid column values by criteria Pin
choopie18-Mar-07 22:25
choopie18-Mar-07 22:25 
GeneralRe: Sum datagrid column values by criteria Pin
mike montagne19-Mar-07 6:25
mike montagne19-Mar-07 6:25 
GeneralRe: Sum datagrid column values by criteria Pin
mike montagne19-Mar-07 6:36
mike montagne19-Mar-07 6:36 
QuestionFunction Parameters... Pin
Prashant C16-Mar-07 3:17
Prashant C16-Mar-07 3:17 
AnswerRe: Function Parameters... Pin
theScorp16-Mar-07 3:27
theScorp16-Mar-07 3:27 
AnswerRe: Function Parameters... Pin
Pete O'Hanlon16-Mar-07 3:46
mvePete O'Hanlon16-Mar-07 3:46 
AnswerRe: Function Parameters... Pin
Scott Dorman16-Mar-07 4:37
professionalScott Dorman16-Mar-07 4:37 
QuestionRAS?? Pin
Muammar©16-Mar-07 2:35
Muammar©16-Mar-07 2:35 
AnswerRe: RAS?? Pin
Mike Dimmick16-Mar-07 4:59
Mike Dimmick16-Mar-07 4:59 
QuestionEnglish please:) Pin
Muammar©16-Mar-07 8:53
Muammar©16-Mar-07 8:53 
QuestionSave a ListView(NewBie) Pin
NGSjamesc16-Mar-07 2:16
NGSjamesc16-Mar-07 2:16 
AnswerRe: Save a ListView(NewBie) Pin
coolestCoder16-Mar-07 2:27
coolestCoder16-Mar-07 2:27 
GeneralRe: Save a ListView(NewBie) Pin
NGSjamesc16-Mar-07 2:56
NGSjamesc16-Mar-07 2:56 
Questionhow can create an ActiveX in C#? Pin
B.A16-Mar-07 1:55
B.A16-Mar-07 1:55 
AnswerRe: how can create an ActiveX in C#? Pin
Muammar©16-Mar-07 2:26
Muammar©16-Mar-07 2:26 
GeneralRe: how can create an ActiveX in C#? Pin
B.A16-Mar-07 2:33
B.A16-Mar-07 2:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.