SmashAndGrab
asked on
ASP.NET code error
Please post your Customer Data code around line 161. Chances are you are trying to access a column collection that does not have the required index value.
It will be better if you post your code, not screenshot.
Usually this error appear, if you ask element, which is not exist in your arryay, because your size array is less.
Are you sure, that your DataTable (dt) have element [0][1] ? Does exist the second column in this DataTable?
Usually this error appear, if you ask element, which is not exist in your arryay, because your size array is less.
Are you sure, that your DataTable (dt) have element [0][1] ? Does exist the second column in this DataTable?
ASKER
Thank you for the comment.
Here is the actual code:
Here is the actual code:
public string[] CustomerAtCompletedStage()
{
var sAvailable = new string[2];
sAvailable[0] = "False";
DataTable dt = CustomerDetails.CompletedRequestStage(_nRequestId);
if (dt.Rows.Count > 0)
{
sAvailable[0] = "True";
sAvailable[1] = dt.Rows[0][1].ToString();
}
return sAvailable;
}
}
}
And what about DataTable?
Does exist element dt.Rows[0][1] ? Can you see it in debugger?
Does exist element dt.Rows[0][1] ? Can you see it in debugger?
ASKER
I inherited this system from a programmer who has now left the company so I don't really understand any of the code! :(
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This error is in method CompleteRequestStage. Your DataTable have not the second column.
ASKER
ok - is there a workaround? i.e. something simple without changing to much of the application code?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am afraid, that it is necessary to you to understand code in CompleteRequestStage method... And find, why your dataTable has not the second column...
ASKER
Is there a way of checking if it exists first?
i.e. Psudeo code:
If dt.Rows[0][0].ToString(); EXISTS then
ok
else
IGNORE
i.e. Psudeo code:
If dt.Rows[0][0].ToString(); EXISTS then
ok
else
IGNORE
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There is no activity from author.