Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!

I am trying to add a data dynamiclly to my GridView but I'm geeting an error:


Exception Details: System.IndexOutOfRangeException: There is no row at position 1.
Source Error:

Line 69: drow = dt.NewRow();
Line 70: dt.Rows.Add(drow);
Line 71: dt.Rows[i][col1] = i.ToString();
Line 72: vol_dobanda = (float.Parse(credit.ToString()) * rata_lunara * i) / 100;
Line 73: dt.Rows[i][col2] = vol_dobanda.ToString();

What did I do wrong ?
Thanks in advance!
Posted

If this is the first row, i should have a value of 0, not 1.
 
Share this answer
 
Comments
Mitran Stefanita Alexandru 2-Apr-11 10:19am    
Thanks... it worked!
Wendelius 2-Apr-11 10:25am    
You're welcome :)
database table column always starts with value 0.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900