D
David
Hi,
(Sorry for duplicate post, finger trouble before I finished...)
using C# 1.1
I am writing a winform app that collects a dataset from a webservice.
At the same time I collect the data, I write the dataset out to the local
disk using DataSet.WriteXml, so that if the webservice is not available,
then the app will continue to run from my saved dataset. If the web service
is not available, then I load the dataset with the ReadXml method.
All appears to work excellent... However, you may have guessed, I have a
problem.
On form load, I load the dataset into a list box datasource. Most of my
application is happy with this. The listbox loads properly and can be used.
BUT...
in one point of the app, I was reading (DataTable)listbox.DataSource (I have
changed it now, but it made no difference) then
DataRow[] DR = DT.Select("ID = " +
Convert.ToInt32(SiteListBox.SelectedValue.ToString()));
then trying to read the DR by...
int SiteCount = Convert.ToInt32(DR[0]["SiteCount"].ToString());
This works almost as expected, but some rows in the dataset (Only when
offline and when the dataset is loaded from the XML) are not being read.
It is odd, but the first 23 rows read OK, the 24, 25 and 26 give an error,
then some later rows work and some others don't.
While in debug command window, (app is Offline)
DR[0]["SiteCount"] <-- THIS ONE WORKS
"4"
DR[0]["SiteCount"] <-- THIS ONE FAILS.
error: 'DR' is not an array or pointer. Indexing is not available
If I run the app while online, and do the same...
DR[0]["SiteCount"]
{4}
System.ValueType: {System.Int32}
m_value: 4
MaxValue: 2147483647
MinValue: -2147483648
DR[0]["SiteCount"]
{16}
System.ValueType: {System.Int32}
m_value: 16
MaxValue: 2147483647
MinValue: -2147483648
I have looked at the XML. An example is...
<Table>
<ID>68</ID>
<SiteName>BradfordFOCUS.Com</SiteName>
<TownName>Bradford</TownName>
<Colour1>#003399</Colour1>
<Colour2>#FFFFFF</Colour2>
<SiteCount>13</SiteCount>
</Table>
I am selecting on the ID field, though the app seems to fail where the ID
number is not in sequential order, though this is not a guaranteed fault as
it can still fail when in sequential order.
Can anyone point me in the right direction?
Thanks.
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
(Sorry for duplicate post, finger trouble before I finished...)
using C# 1.1
I am writing a winform app that collects a dataset from a webservice.
At the same time I collect the data, I write the dataset out to the local
disk using DataSet.WriteXml, so that if the webservice is not available,
then the app will continue to run from my saved dataset. If the web service
is not available, then I load the dataset with the ReadXml method.
All appears to work excellent... However, you may have guessed, I have a
problem.
On form load, I load the dataset into a list box datasource. Most of my
application is happy with this. The listbox loads properly and can be used.
BUT...
in one point of the app, I was reading (DataTable)listbox.DataSource (I have
changed it now, but it made no difference) then
DataRow[] DR = DT.Select("ID = " +
Convert.ToInt32(SiteListBox.SelectedValue.ToString()));
then trying to read the DR by...
int SiteCount = Convert.ToInt32(DR[0]["SiteCount"].ToString());
This works almost as expected, but some rows in the dataset (Only when
offline and when the dataset is loaded from the XML) are not being read.
It is odd, but the first 23 rows read OK, the 24, 25 and 26 give an error,
then some later rows work and some others don't.
While in debug command window, (app is Offline)
DR[0]["SiteCount"] <-- THIS ONE WORKS
"4"
DR[0]["SiteCount"] <-- THIS ONE FAILS.
error: 'DR' is not an array or pointer. Indexing is not available
If I run the app while online, and do the same...
DR[0]["SiteCount"]
{4}
System.ValueType: {System.Int32}
m_value: 4
MaxValue: 2147483647
MinValue: -2147483648
DR[0]["SiteCount"]
{16}
System.ValueType: {System.Int32}
m_value: 16
MaxValue: 2147483647
MinValue: -2147483648
I have looked at the XML. An example is...
<Table>
<ID>68</ID>
<SiteName>BradfordFOCUS.Com</SiteName>
<TownName>Bradford</TownName>
<Colour1>#003399</Colour1>
<Colour2>#FFFFFF</Colour2>
<SiteCount>13</SiteCount>
</Table>
I am selecting on the ID field, though the app seems to fail where the ID
number is not in sequential order, though this is not a guaranteed fault as
it can still fail when in sequential order.
Can anyone point me in the right direction?
Thanks.
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available