dbTalk Databases Forums  

MSDN SqlXml example doesn't work

microsoft.public.sqlserver.xml microsoft.public.sqlserver.xml


Discuss MSDN SqlXml example doesn't work in the microsoft.public.sqlserver.xml forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark Sisson
 
Posts: n/a

Default MSDN SqlXml example doesn't work - 11-25-2003 , 09:12 PM






Anyone have any ideas why this doesn't work for me? My Test.EXE app
pegs on CPU usage when I step through the Fill statement and the
debugger never gets to the next statement.

OS: XP Pro
SQL: 2000 (local)
SQLXML: 3.0sp2

Thanks for any ideas
mark

================ C# ================
string NorthwindConnString = @"Provider=SQLOLEDB;Data
Source=LAPTOP\LAPTOP; User ID=XXX; Password=XXX; Database=Northwind";
SqlXmlCommand cmd = new SqlXmlCommand(NorthwindConnString);
cmd.RootTag = "ROOT";
cmd.CommandText = "Categories";
cmd.CommandType = SqlXmlCommandType.XPath;
cmd.SchemaPath = @"c:\Categories.xsd";
DataSet ds = new DataSet();
SqlXmlAdapter ad = new SqlXmlAdapter(cmd);
ad.Fill(ds); //<<<CPU GOES NUTS HERE AND NEVER COMES BACK
ds.Tables["Categories"].Rows[0]["CategoryName"] = "Drinks";
ad.Update(ds);

============= Categories.xsd ============
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xs:element name="Categories">
<xs:complexType>
<xs:sequence>
<xs:element name="CategoryID" type="xs:integer"/>
<xs:element name="CategoryName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Reply With Quote
  #2  
Old   
Bob Beauchemin
 
Posts: n/a

Default Re: MSDN SqlXml example doesn't work - 11-26-2003 , 12:26 AM






Hmmm...

This exact code, cut and pasted into VS 1.1 with schema file in the root of
c:\, works fine for me. The only thing I changed was the connection string
(to "data source=.;integrated security=sspi"...left the rest of connstring
intact).

In fact, even through the schema specifies utf-8, it worked whether I
actually saved the file as UTF-8 or ANSI from notepad.

Same setup, although my SQL Server (2000 SP3) is on the same machine as the
program, if that's different.

Bob Beauchemin
http://staff.develop.com/bobb


"Mark Sisson" <mark (AT) corporatedigital (DOT) com> wrote

Quote:
Anyone have any ideas why this doesn't work for me? My Test.EXE app
pegs on CPU usage when I step through the Fill statement and the
debugger never gets to the next statement.

OS: XP Pro
SQL: 2000 (local)
SQLXML: 3.0sp2

Thanks for any ideas
mark

================ C# ================
string NorthwindConnString = @"Provider=SQLOLEDB;Data
Source=LAPTOP\LAPTOP; User ID=XXX; Password=XXX; Database=Northwind";
SqlXmlCommand cmd = new SqlXmlCommand(NorthwindConnString);
cmd.RootTag = "ROOT";
cmd.CommandText = "Categories";
cmd.CommandType = SqlXmlCommandType.XPath;
cmd.SchemaPath = @"c:\Categories.xsd";
DataSet ds = new DataSet();
SqlXmlAdapter ad = new SqlXmlAdapter(cmd);
ad.Fill(ds); //<<<CPU GOES NUTS HERE AND NEVER COMES BACK
ds.Tables["Categories"].Rows[0]["CategoryName"] = "Drinks";
ad.Update(ds);

============= Categories.xsd ============
?xml version="1.0" encoding="utf-8" ?
xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema"
xs:element name="Categories"
xs:complexType
xs:sequence
xs:element name="CategoryID" type="xs:integer"/
xs:element name="CategoryName" type="xs:string"/
/xs:sequence
/xs:complexType
/xs:element
/xs:schema



Reply With Quote
  #3  
Old   
Bryant Likes
 
Posts: n/a

Default Re: MSDN SqlXml example doesn't work - 11-26-2003 , 10:33 AM



"Mark Sisson" <mark (AT) corporatedigital (DOT) com> wrote

[snip]
Quote:
Thanks for any ideas
1) Reboot
2) Recompile

Have you started a SQL Trace to see if anything is making it to the
database?

--
Bryant





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.