# Miscellaneous > Database Programming >  Index was outside the bounds of the array.

## paul mancuso

Frank,

I can't seem to get by this error.  Can you give any direction as to how to approach debugging this?

it seems like .NET generates this, and it occurs once I press the add or update button in Tornado so normal Tornado debug can't reply.

Index was outside the bounds of the array. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error: 


Line 283:      ' **************************************************  *****************
Line 284:             
Line 285:        .aspDBNet(Condition)
Line 286:        
Line 287:        if (lstClick="gridadd") then


Source File: E:\NYExtranet\Tornado\scratch\StipMPO_AddEdit_Phas  e.aspx    Line: 285 

Stack Trace: 


[IndexOutOfRangeException: Index was outside the bounds of the array.]
   Tornado.RS_OleDB.GetRS_CR(String dsn, String sql, String act) +13065
   Tornado.RS.GetRS_CR(String act) +928
   Tornado.z.ASPdbNET(String MainOpt) +1240
   ASP.StipMPO_AddEdit_Phase_aspx.Page_Load(Object Source, EventArgs E) in E:\NYExtranet\Tornado\scratch\StipMPO_AddEdit_Phas  e.aspx:285
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731

 thanks in advance,  Paul


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

----------


## Frank

Give me some code to produce the error. Out of bound array index usually is caused by mis-matched fields in various display and editing activities.

FK

----------


## paul mancuso

Thanks for the heads up on this error.  I'll look over the fields display, edit, add etc., and send you my code as an attachment to an email. it's rather long...

Also, do you think Tornado needs a .dbeditGridUpdateSQL and .dbeditGridAddSQL to go along with the new functions (.dbeditGridAddflds and .dbeditGridUpdateflds)?

----------


## Frank

there is editupdate and Add SQL already. You mean the "Grid" edit setup needs it's own set of SQL? It is kind of deep but possible.

Frank

----------


## paul mancuso

I think it makes sense.  This way the developer can specify the exact SQL statment for the new functions.  It takes the guess work out of the picture..

Getting back to the 
"Index was outside the bounds of the array" error I can't get around.

I have narrowed the issue down to the SQL statement. So, I created a test program to simply add a record to 2 tables.  The SQL statement works in MS SQL Server, "Query Analizer" but not in the .aspx file.  What's with this? It's a very simple SQL statement:

Select * FROM mpoProject,ProjectLocation

What do you think?

----------


## Frank

I'll look at your attached code

FK

----------


## Frank

The Grid Edit SQLs seems resonable. I'll get to that middle of next week.


FK

----------

