-
January 14th, 2009, 03:30 AM
#1
DataColumn.Ordinal is -1 when running my app on one webserver
I have a web application (ASP.NET 2.0) that is published on three servers (all working against one database). When I run the code below I got an ArgumentOutOfRangeException on just one of my webbservers. Very strange…
All tips of where to start finding the error source are welcomed. I’m running IIS 6.0 and .NET 2.0. It fells like a IIS configuration of handling exceptions… or?
public static DataRow Process(DataRow source0, DataRow source1, List<ProcessItemHandler> handlers)
{
DataRow target = source0.Table.NewRow();
foreach (DataColumn column in source0.Table.Columns)
{
int n = column.Ordinal;
ProcessItemHandler handler = handlers[n];
…
...and justice for all
-
January 29th, 2009, 03:09 AM
#2
Re: DataColumn.Ordinal is -1 when running my app on one webserver
Hi,
It is difficult to say with just this amount of code. You had better check the DataRow source0 properly and examine the number of columns in it as that is being passed to the function. You can use something like
int n = source0.Table.Columns.Count;
That would tell you the total number of columns source0 has. The number -1 is generally used to indicate the inability to find something in .net. If your ordinal is -1 then I doubt if there are any columns at all in your row. Still beats me how it ever gets into the loop if that is the case.
Or alternately you can try some code like
for(int i =0; i < source0.Table.Columns.Count; i++)
{
ProcessItemHandler handler = handlers[i];
}
That I think would ease things.
Hope this helps.
Regards,
sr_jay
-
January 29th, 2009, 02:46 PM
#3
Re: DataColumn.Ordinal is -1 when running my app on one webserver
I now have noticed that I got the error sometimes when the IIS as made a recycle...
...and justice for all
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|