A
Antoine
Herfried and Cor:-
I used tracing and actually tracked down the code that was causing the
problem most likely. I wonder if you wanted to comment on it.
Also I wonder if there is a better way of testing if there is data than
testing the length of the xml string I used as stringreader to create the
dataset, but thats a side issue.
I think I tried isdbnull and is nothing and stuff like that and they cause
run time errors if there isnt any data, in other areas of code I have had
problems with using it so found this a reasonable way of ensuring the string
returned with data that must mean there was data - as I have a catch anyway
so if any errors occur, it will quit before it gets to these string length
testing parts of code.
Anyway back to the actual problem. I THINK its because the application
usually throws a comma in the field1, but I can reproduce the error if I
don't.
I THINK I either need to change my selection of fields (and get less
complicated and get data from seperate fields that might contain same data )
or test for an index of comma in the file, and do something different if
there is no comma.
If Len(xmlstr1) > 25 Then
For intCounter = 0 To dataset1.Tables("result").Rows.Count - 1
dt.Rows.Add(CreateRow("[" +
dataset1.Tables("result").Rows(intCounter).Item("field1").split(",")(1).subs
tring(1, 1).toupper +
dataset1.Tables("result").Rows(intCounter).Item("field1").split(",")(0).subs
tring(0, 1).toupper + "]:" +
dataset1.Tables("result").Rows(intCounter).Item("field1"),
dataset1.Tables("result").Rows(intCounter).Item("field2"), dt))
Next
End If
"An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the exception
can be identified using the exception stack trace below.
Stack Trace:
[IndexOutOfRangeException: Index was outside the bounds of the array.]
System.Array.InternalGetValue(Int32 index1, Int32 index2, Int32 index3)
+0
System.Array.GetValue(Int32 index) +32
Microsoft.VisualBasic.CompilerServices.LateBinding.LateIndexGet(Object o,
Object[] args, String[] paramnames) +187
sharedcal.ShareCal.o() +655
sharedcal.ShareCal.Page_Load(Object o, EventArgs e) +799
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
I used tracing and actually tracked down the code that was causing the
problem most likely. I wonder if you wanted to comment on it.
Also I wonder if there is a better way of testing if there is data than
testing the length of the xml string I used as stringreader to create the
dataset, but thats a side issue.
I think I tried isdbnull and is nothing and stuff like that and they cause
run time errors if there isnt any data, in other areas of code I have had
problems with using it so found this a reasonable way of ensuring the string
returned with data that must mean there was data - as I have a catch anyway
so if any errors occur, it will quit before it gets to these string length
testing parts of code.
Anyway back to the actual problem. I THINK its because the application
usually throws a comma in the field1, but I can reproduce the error if I
don't.
I THINK I either need to change my selection of fields (and get less
complicated and get data from seperate fields that might contain same data )
or test for an index of comma in the file, and do something different if
there is no comma.
If Len(xmlstr1) > 25 Then
For intCounter = 0 To dataset1.Tables("result").Rows.Count - 1
dt.Rows.Add(CreateRow("[" +
dataset1.Tables("result").Rows(intCounter).Item("field1").split(",")(1).subs
tring(1, 1).toupper +
dataset1.Tables("result").Rows(intCounter).Item("field1").split(",")(0).subs
tring(0, 1).toupper + "]:" +
dataset1.Tables("result").Rows(intCounter).Item("field1"),
dataset1.Tables("result").Rows(intCounter).Item("field2"), dt))
Next
End If
"An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the exception
can be identified using the exception stack trace below.
Stack Trace:
[IndexOutOfRangeException: Index was outside the bounds of the array.]
System.Array.InternalGetValue(Int32 index1, Int32 index2, Int32 index3)
+0
System.Array.GetValue(Int32 index) +32
Microsoft.VisualBasic.CompilerServices.LateBinding.LateIndexGet(Object o,
Object[] args, String[] paramnames) +187
sharedcal.ShareCal.o() +655
sharedcal.ShareCal.Page_Load(Object o, EventArgs e) +799
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750