Thema: Delphi FOR XML Query

Einzelnen Beitrag anzeigen

Benutzerbild von Stevie
Stevie

Registriert seit: 12. Aug 2003
Ort: Soest
4.016 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#3

Re: FOR XML Query

  Alt 12. Dez 2008, 13:52
Habs sowohl mit varchar als auch mit nvarchar getestet, beides erfolglos.
Hier einmal die Abfrage:
SQL-Code:
select cat.catname, prod.productname
from categories cat join products prod on catid = productcat
for xml auto, elements
Dies ist der xml Text, den mir Management Studio anzeigt:
XML-Code:
<cat>
  <catname>ASP</catname>
  <prod>
    <productname>Learning ASP in 24 hours version 1</productname>
  </prod>
  <prod>
    <productname>ASP and SQL 2000: The power to develop</productname>
  </prod>
</cat>
<cat>
  <catname>VB.NET</catname>
  <prod>
    <productname>Beginners guide to eCommerce with ASP and XML</productname>
  </prod>
  <prod>
    <productname>Exploring VB.NET Beta 2</productname>
  </prod>
</cat>
<cat>
  <catname>C#.NET</catname>
  <prod>
    <productname>Migrating from C++ to C#</productname>
  </prod>
</cat>
Und das kommt raus, wenn ichs über die ADOQuery abfrage (aus dem Debug Inspector kopiert):

- mit nvarchar Feldern:
Code:
'D'#7'c'#0'a'#0't'#0'n'#0'a'#0'm'#0'e'#0'D'#$B'p'#0'r'#0'o'#0'd'#0'u'#0'c'#0't'#0'n'#0'a'#0'm'#0'e'#0'D'#3'c'#0'a'#0't'#0'D'#4'p'#0'r'#0'o'#0'd'#0#1#3'A'#1#1'A'#3#$11#6#0'A'#0'S'#0'P'#0''#1#1#4'A'#1#2'A'#3#$11'D'#0'L'#0'e'#0'a'#0'r'#0'n'#0'i'#0'n'#0'g'#0' '#0'A'#0'S'#0'P'#0' '#0'i'#0'n'#0' '#0'2'#0'4'#0' '#0'h'#0'o'#0'u'#0'r'#0's'#0' '#0'v'#0'e'#0'r'#0's'#0'i'#0'o'#0'n'#0' '#0'1'#0''#2''#4#1#4'A'#1#2'A'#3#$11'L'#0'A'#0'S'#0'P'#0' '#0'a'#0'n'#0'd'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#3#$10'ä'#4#0#0'"'#0'Learning ASP in 24 hours version 1'#2''#4#1#4'A'#1#2'A'#3#$10'ä'#4#0#0'&'#0'ASP and SQL 2000: The power to develop'#2''#4''#3#1#3'A'#1#1'A'#3#$10'ä'#4#0#0#6#0'VB.NET'#1#1#4'A'#1#2'A'#3#$10'ä'#4#0#0'-'#0'Beginners guide to eCommerce with ASP and XML'#2''#4#1#4'A'#1#2'A'#3#$10'ä'#4#0#0#$17#0'Exploring VB.NET Beta 2'#2''#4''#3#1#3'A'#1#1'A'#3#$10'ä'#4#0#0#6#0'C#.NET'#1#1#4'A'#1#2'A'#3#$10'ä'#4#0#0#$18#0'Migrating from C++ to C#'#2''#4''#3
Stefan
“Simplicity, carried to the extreme, becomes elegance.” Jon Franklin

Delphi Sorcery - DSharp - Spring4D - TestInsight
  Mit Zitat antworten Zitat