Understand Coding

kstoneman10

Member
Joined
Feb 20, 2010
Messages
11
Programming Experience
3-5
I resently took over a VB project that had the following coding:
VB.NET:
       While rs1.Read()
                    ncotot += rs1("Actual")
                    nchtot += rs1("Handled")
                    sltot += rs1("SlCalls")
                End While

rs1 is a SQL string.

My question is what does += do and where can i learn more about it.
 
It looks more like rs1 is results from a SQL query, maybe a sqldatareader. The symbols you asked about is an addition. Its the same as myvar = myvar +1

The s1calls being the number that's added

Sent from my XT910 using Tapatalk 2
 
As mentionned, rs1 is a DataReader. The .Read() method advances to the next row. In this case, the code adds (or appends) the values in the fields Actual, Handled, and SlCalls of each row to the very poorly named variables ncotot, nchtot, and sltot. What would have been a better approach would have been to put the results in a datatable and use the aggregate methods to count the total.
 
Back
Top