TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Naadir Peterson
NA
87
0
Index was out of range. Must be non-negative and less than the size of the collection
Jul 20 2007 10:35 AM
"Index was out of range. Must be non-negative and less than the size of the collection" I am getting the error on the line marked with an (*): public List
PersonsForYear(int year) { List
lPerson = new List
(); //Variable to assign array from list from specifed month int[] iPMonthly = new int[3]; //Variable to hold Year Totals for each array int[] iYearTotal = new int[3]; List
lMonth = new List
(); lMonth = MonthList(); for (int i = 0; i < 12; i++) { //Fill the array iPMonthly = PersonMonthlyRep(Convert.ToDateTime("01 " + lMonth[i] + " " + year)); //Assign the array to specified list ***lPerson[i] = iPMonthly; //Assigns the yearly total iYearTotal[0] += iPMonthly[0]; iYearTotal[1] += iPMonthly[1]; iYearTotal[2] += iPMonthly[2]; } //Assign the yearly total array to the list lPerson[12] = iYearTotal; return lPerson; } My query: select @enddate = dbo.ufn_GetLastDayOfMonth(@begindate) select sum(cnl.conclusion_personalive) as 'Alive', sum(cnl.conclusion_persondeceased) as 'Deceased', sum(cnl.conclusion_personmissing) as 'Missing' from tbl_conclusion cnl (nolock), tbl_incident inc (nolock) where cnl.conclusion_incidentid = inc.incident_id and inc.incident_datetime between @begindate and @enddate Overview: PersonMonthlyRep(DateTime) method returns the above query in an int[3] array, which is called 12 times for each month of the year. I then get the overall yearly total at the end. I'm assuming its something to do with the List of int arrays that i created but i can't seem to figure out what i'm doing wrong. Thanx
Reply
Answers (
1
)
Override User Control...?
Consume a .htaccess-proctected webservice in C#