473,486 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Difference between .NET 1.1 Dataset.ReadXML and .NET2.0 BETA Dataset.ReadXML

I have written a web service in C#, .NET 1.1 which reads a XML file into a
dataset.
This is just a plain XML file. First I use the Dataset.ReadXmlScheme
function and pass the XML file to it. Then I convert data type of one of the
column to integer and then I use the Dataset.ReadXml function and pass the
same file to it. This works on my machine, but when I run it on a .NET 2.0
machine it thows an exception with message "Input string was not in correct
format". The XML document is well formed and also all the column has all
values numeric.
So I installed .NET 2.0 on my machine keeping .NET 1.1 as it was. Then on
asociating the web service virtual directory in IIS with .NET 1.1 it works
fine and on associating it with .NET 2.0 it gives above error.
Does it has to do with converting the column to integer type?
Nov 12 '05 #1
8 5668
Can you give me the XML which causes this, as well as the call stack where
the Exception is thrown?

Thanks,
Zafar

"Nikhilesh Mehendale" <ni********@maqsoftware.com> wrote in message
news:ec*************@TK2MSFTNGP12.phx.gbl...
I have written a web service in C#, .NET 1.1 which reads a XML file into a
dataset.
This is just a plain XML file. First I use the Dataset.ReadXmlScheme
function and pass the XML file to it. Then I convert data type of one of the column to integer and then I use the Dataset.ReadXml function and pass the
same file to it. This works on my machine, but when I run it on a .NET 2.0
machine it thows an exception with message "Input string was not in correct format". The XML document is well formed and also all the column has all
values numeric.
So I installed .NET 2.0 on my machine keeping .NET 1.1 as it was. Then on
asociating the web service virtual directory in IIS with .NET 1.1 it works
fine and on associating it with .NET 2.0 it gives above error.
Does it has to do with converting the column to integer type?

Nov 12 '05 #2
The attachement was blocked since it was an XML file, please send in some
other format like .zip.

Thanks,
Zafar

"Nikhilesh Mehendale" <ni********@maqsoftware.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
The attached file (only part of it as the original file is large) contains
an attribute score for in every child element.
This after loading the schema into the dataset is converted to integer
format using ReadXmlSchema function of the DataSet class and then the XML
file is read using the ReadXml function. Suprisingly it works fine if I
associate it to run with .NET 1.1 and does not if I associate it with .NET
2.0 with out. Also I am not able to debug when I use .NET 2.0 using Visual
Studio 2003.
This is the call stack
[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options,
NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2751235 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo
info) +102
System.Xml.XmlConvert.ToInt32(String s) +100
System.Data.Common.Int32Storage.ConvertXmlToObject (String s) +23
System.Data.XmlDataLoader.LoadColumn(DataColumn column, Object[]
foundColumns) +350
System.Data.XmlDataLoader.LoadTopMostTable(DataTab le table) +592
System.Data.XmlDataLoader.LoadData(XmlReader reader) +1669565
System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving) +842 System.Data.DataSet.ReadXml(String fileName) +62
MBADatabase.MBAData.GetScores() +138
MBADatabase.ScoreSheet.Page_Load(Object sender, EventArgs e) +78
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

Nov 12 '05 #3
Thanks. Could you also post the code which works in .NET 1.1 and not in .NET
2.0.?

Zafar Abbas
"Nikhilesh Mehendale" <ni********@maqsoftware.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
File attached, compressed using Winzip 9.0

Nov 12 '05 #4
could you please provide the source code as well?

"Nikhilesh Mehendale" <ni********@maqsoftware.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
File attached, compressed using Winzip 9.0

Nov 12 '05 #5
DataSet dataSet = new DataSet();
string xmlFile = "C:\Data.xml";

//Check if the file exists
if (File.Exists(xmlFile))
{
dataSet.ReadXmlSchema(xmlFile);
}
else //return null if file does not exist
{
return null;
}

//Convert the scores column to integer
dataSet.Tables[0].Columns["score"].DataType = typeof(int);

try
{
dataSet.ReadXml(xmlFile);
}
catch(Exception ea)
{
MessageBox.Show(ea.Message);
}

This is the part of code wich works in .Net Framework 1.1 and not in 2.0.
The try block throws exception at the statement dataSet.ReadXml(xmlFile)
Nov 12 '05 #6
Nikhilesh ,
I am realy sorry, I need you to send me the XML file again. I am unable to
locate it in the archive.

Thanks,
Zafar
"Nikhilesh Mehendale" <ni********@maqsoftware.com> wrote in message
news:O0**************@TK2MSFTNGP14.phx.gbl...
DataSet dataSet = new DataSet();
string xmlFile = "C:\Data.xml";

//Check if the file exists
if (File.Exists(xmlFile))
{
dataSet.ReadXmlSchema(xmlFile);
}
else //return null if file does not exist
{
return null;
}

//Convert the scores column to integer
dataSet.Tables[0].Columns["score"].DataType = typeof(int);

try
{
dataSet.ReadXml(xmlFile);
}
catch(Exception ea)
{
MessageBox.Show(ea.Message);
}

This is the part of code wich works in .Net Framework 1.1 and not in 2.0.
The try block throws exception at the statement dataSet.ReadXml(xmlFile)

Nov 12 '05 #7
Nikhilesh,
This is an issue in .NET framework 2.0 which might be fixed in a service
pack. As a work around for .NET 2.0, could you rename your attribute score,
so that its name is different than the element itself.

Thanks,
Zafar
"Nikhilesh Mehendale" <ni********@maqsoftware.com> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
Here is the file
"Zafar Abbas" <so*****@somewhere.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Nikhilesh ,
I am realy sorry, I need you to send me the XML file again. I am unable to locate it in the archive.

Thanks,
Zafar
"Nikhilesh Mehendale" <ni********@maqsoftware.com> wrote in message
news:O0**************@TK2MSFTNGP14.phx.gbl...
DataSet dataSet = new DataSet();
string xmlFile = "C:\Data.xml";

//Check if the file exists
if (File.Exists(xmlFile))
{
dataSet.ReadXmlSchema(xmlFile);
}
else //return null if file does not exist
{
return null;
}

//Convert the scores column to integer
dataSet.Tables[0].Columns["score"].DataType = typeof(int);

try
{
dataSet.ReadXml(xmlFile);
}
catch(Exception ea)
{
MessageBox.Show(ea.Message);
}

This is the part of code wich works in .Net Framework 1.1 and not in 2.0. The try block throws exception at the statement dataSet.ReadXml(xmlFile)



Nov 12 '05 #8
Well, may be that also. But also the name of the root element and the name
of the child element is same that was causing problem. I changes the name of
the root element from <score> to <scores> and it worked. May be .Net 2.0 is
strict about the names of root element and child elements

"Zafar Abbas" <so*****@somewhere.com> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
Nikhilesh,
This is an issue in .NET framework 2.0 which might be fixed in a service
pack. As a work around for .NET 2.0, could you rename your attribute
score,
so that its name is different than the element itself.

Thanks,
Zafar
"Nikhilesh Mehendale" <ni********@maqsoftware.com> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
Here is the file
"Zafar Abbas" <so*****@somewhere.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
> Nikhilesh ,
> I am realy sorry, I need you to send me the XML file again. I am unable to > locate it in the archive.
>
> Thanks,
> Zafar
>
>
> "Nikhilesh Mehendale" <ni********@maqsoftware.com> wrote in message
> news:O0**************@TK2MSFTNGP14.phx.gbl...
>> DataSet dataSet = new DataSet();
>> string xmlFile = "C:\Data.xml";
>>
>> //Check if the file exists
>> if (File.Exists(xmlFile))
>> {
>> dataSet.ReadXmlSchema(xmlFile);
>> }
>> else //return null if file does not exist
>> {
>> return null;
>> }
>>
>> //Convert the scores column to integer
>> dataSet.Tables[0].Columns["score"].DataType = typeof(int);
>>
>> try
>> {
>> dataSet.ReadXml(xmlFile);
>> }
>> catch(Exception ea)
>> {
>> MessageBox.Show(ea.Message);
>> }
>>
>> This is the part of code wich works in .Net Framework 1.1 and not in 2.0. >> The try block throws exception at the statement dataSet.ReadXml(xmlFile) >>
>>
>
>



Nov 12 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4778
by: Jeffrey A. Voigt | last post by:
I'm having trouble loading some xml data into a dataset via the ReadXML call. I'm loading into the dataset an xml schema prior to the ReadXML call. I see that there IS in fact, 3 records that...
1
5807
by: mr_dom_is | last post by:
Hi I have a little bit of trouble, probably missing the point now sure but: I have a dataset dim ds as new dataset("User") Which is populated with data from a database. When I use
1
3127
by: kids_pro | last post by:
I had come across a code block from Loading a DataSet from XML (.NET Framework Developer's Guide) ---------------------------------------- NOte If you call ReadXML to load a very large file, you...
1
1248
by: Raymond Du | last post by:
Hi, I am using Dataset's ReadXML method to read an XML file. Here i s my code snippet: Dim dsTemp As New DataSet dsTemp.ReadXml(Server.MapPath("~/data3.xml")) and data3.xml as follow:...
4
1296
by: Shapper | last post by:
Hello, I have a XML file that includes the node <item>: .... <title>...</title> <url>...</url> <item> <title>title 01</title> <description>description 01</description> </item>
22
25544
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
12
23726
by: Marc | last post by:
I have used XMLDataToString = DataSetForXML.GetXml() to get an XML string from a dataset. I am looking for a way to create a dataset from this XML string. I tried...
11
3916
by: MurdockSE | last post by:
Greetings. My Situation: // I have an .xml file that I am reading into a dataset in the following code - DataSet ds = new DataSet("MyDataset"); ds.ReadXml(@"c:\data\"+cmyxmlfilename);
1
3614
by: Mac | last post by:
I'm trying to validate input from an xml source to a dataset in dotnet2.0. As far as I can see, type errors correctly cause an exception, but values that are the correct type but do not satisify...
0
7126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.