If the same problem still persists, you may simplify the code and script
with detailed reproducing steps, so that we are able to test this problem
on my side.
Sincerely,
Kevin
Microsoft Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! -
www.microsoft.com/security
--------------------
| Reply-To: "Bruno van Dooren" <
[email protected]>
| From: "Bruno van Dooren" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
| Subject: Re: Xml reader not reading data into dataset
| Date: Tue, 30 Sep 2003 18:26:29 +0200
| Lines: 85
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: d5153d3a6.kabel.telenet.be 81.83.211.166
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:62495
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| > 1. Does the same problem occur when using the SQL statement as below?
| > SELECT * FROM t_Data FOR XML AUTO, XMLDATA
| yes. the XML looks a little different, but the dataset remains empty.
|
|
| > 2. Run the SQL statement in Query Analyze, does it works?
| it returns
| <Schema name="Schema1" xmlns="urn:schemas-microsoft-com:xml-data"
| xmlns:dt="urn:schemas-microsoft-com:datatypes"><ElementType name="t_Data"
| content="empty" model="closed"><AttributeType name="data_name"
| dt:type="string"/><AttributeType name="value1" dt:typ
|
| it seems not to return all data when executing your query in the query
| analyser. this is probably a query analyzer issue.
| if i try the following in code:
| System.Xml.XmlReader myReader;
|
| SqlCommand myCommand =
|
| new SqlCommand("SELECT * FROM t_Data FOR XML AUTO, XMLDATA",
|
| sqlConnTest);
|
| sqlConnTest.Open();
|
| myReader = myCommand.ExecuteXmlReader();
|
|
| while(myReader.Read())
|
| {
|
| txtXml.AppendText(myReader.ReadOuterXml());
|
| }
|
| myReader.Close();
|
| the textbox contains:
| <Schema name="Schema1" xmlns="urn:schemas-microsoft-com:xml-data"
| xmlns:dt="urn:schemas-microsoft-com:datatypes"><ElementType name="t_Data"
| content="empty" model="closed"><AttributeType name="data_name"
| dt:type="string" /><AttributeType name="value1" dt:type="r8"
| /><AttributeType name="value2" dt:type="r8" /><AttributeType
name="deleted"
| dt:type="boolean" /><attribute type="data_name" /><attribute type="value1"
| /><attribute type="value2" /><attribute type="deleted"
| /></ElementType></Schema><t_Data xmlns="x-schema:#Schema1"
data_name="test2"
| value1="2.000000000000000e+000" value2="3.000000000000000e+000"
deleted="0"
| />
|
| even though the table does contain 3 records.
| if i try the original query:
|
| the textbox contains
| <Schema name="Schema1" xmlns="urn:schemas-microsoft-com:xml-data"
| xmlns:dt="urn:schemas-microsoft-com:datatypes"><ElementType name="t_Data"
| content="eltOnly" model="closed" order="many"><element type="data_name"
| /><element type="value1" /><element type="value2" /><element
type="deleted"
| /></ElementType><ElementType name="data_name" content="textOnly"
| model="closed" dt:type="string" /><ElementType name="value1"
| content="textOnly" model="closed" dt:type="r8" /><ElementType
name="value2"
| content="textOnly" model="closed" dt:type="r8" /><ElementType
name="deleted"
| content="textOnly" model="closed" dt:type="boolean" /></Schema><data_name
| xmlns="x-schema:#Schema1">test</data_name><value2
| xmlns="x-schema:#Schema1">2.000000000000000e+000</value2><data_name
| xmlns="x-schema:#Schema1">test2</data_name><value2
| xmlns="x-schema:#Schema1">3.000000000000000e+000</value2><data_name
| xmlns="x-schema:#Schema1">test3</data_name><value2
| xmlns="x-schema:#Schema1">4.000000000000000e+000</value2>
|
| the values for column 'value1' are nowhere to be found.
|
| > 3. Does the same problem occur when using a different database?
| i will try to test it tomorrow. i have to leave now.
|
| > 4. How did you check whether or not the dataset has only schema?
| what do you mean by this question? do want to knwo if there is data in the
| database? i think i misunderstand your question
|
| would it be of any help if i send you my code and a script of my database?
|
| kind regards,
| Bruno.
|
|
|