473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 5664
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
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
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
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
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
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
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
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
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.